Solved

upload files

Posted on 2011-02-27
6
373 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

830 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