Solved

upload files

Posted on 2011-02-27
6
347 Views
Last Modified: 2012-05-11
Hi

is it possible to host upload form in server01 and store file in another server?

currently im using this jquery plugin

http://aquantum-demo.appspot.com/file-upload

Open in new window


and it says plugin is able to

Cross-site file uploads:
Supports uploading files to a different domain with Cross-site XMLHttpRequests.

but i have no idea how to do it..

any help would be great

Thanks
0
Comment
Question by:3xtr3m3d
  • 3
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
Julian Matz earned 250 total points
ID: 34990954
Hi! I think this is only supported by Firefox 3, but I'm not certain. Anyway, you can try by either adding this to your PHP file:

<?php
// Change this to allow <yourdomain.com> to make it accessible to your site, or allow <*> for ANYONE to be able to access it.
header('Access-Control: allow <yourdomain.com>');
?>

Open in new window


... Or by creating an XML file with the following:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Change this to allow="yourdomain.com" to make it accessible to your site, or allow="*" for ANYONE to be able to access it. -->
<?access-control allow="yourdomain.com"?>

Open in new window


A .htaccess file might work also.

Some more information:

https://developer.mozilla.org/En/HTTP_Access_Control

Hope this helps.
0
 
LVL 4

Assisted Solution

by:LAMASE
LAMASE earned 250 total points
ID: 34990981
The upload form in server1 and you want to send you file in another one?
On server 1 your form should simply have action="server2/path/file.php"

With the plugin the easiest thing is to put it on the second server, then call it from the first, depending on how you show the file upload form.
0
 
LVL 3

Author Comment

by:3xtr3m3d
ID: 34990989
Thanks for the quick reply.

$(function () {
    $('#file_upload').fileUploadUI({
        uploadTable: $('#files'),
        downloadTable: $('#files'),
        buildUploadRow: function (files, index) {
            return $('<tr><td>' + files[index].name + '<\/td>' +
                    '<td class="file_upload_progress"><div><\/div><\/td>' +
					'<td class="file_upload_start">' +
					'<button class="ui-state-default ui-corner-all" title="Start Upload">' +
					'<span class="ui-icon ui-icon-circle-arrow-e">Start Upload<\/span>' +
					'<\/button><\/td>' +
                    '<td class="file_upload_cancel">' +
                    '<button class="ui-state-default ui-corner-all" title="Cancel">' +
                    '<span class="ui-icon ui-icon-cancel">Cancel<\/span>' +
                    '<\/button><\/td><\/tr>');
        },
        buildDownloadRow: function (file) {
            return $('<tr class="ui-state-highlight ui-corner-all"><td>' + file.name + '<\/td>' + 
			'<td>' + file.message1 + file.message2 + file.message3 + '<\/td><\/tr>');
        },
		beforeSend: function (event, files, index, xhr, handler, callBack) {
			handler.uploadRow.find('.file_upload_start button').click(callBack);
		}

    });
});
]

Open in new window


<form id="file_upload" action="upload.php" method="POST" enctype="multipart/form-data">  
<input type="hidden" name="MAX_FILE_SIZE" value="1638400000" /><input type="file" name="file" multiple><button id="start_uploads">Start uploads</button>
</form>


thats my upload form and upload file is handling using upload.php


so if i want to upload file to another server, should i put upload.php on second server and call it from 1st server?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 4

Expert Comment

by:LAMASE
ID: 34990990
Yes.
0
 
LVL 3

Author Comment

by:3xtr3m3d
ID: 34991096
i tried like this

<form id="file_upload" action="remote-server/upload.php" method="POST" enctype="multipart/form-data">  

but nothing happens .
0
 
LVL 4

Expert Comment

by:LAMASE
ID: 34991275
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now