Solved

upload files

Posted on 2011-02-27
6
384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 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