Solved

upload files

Posted on 2011-02-27
6
366 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

831 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