loading

Multi location upload save time script!

I recently was asked a question by my fellow staff members who are required to submit the exact same data but to 5 sites for each file. This would normally require them to visit each side and select the file via <input type='file' as normal and submitting.

The question was obviously is there a way to cut the process time of each file?

After 24 hours of lots and lots of reading and trying most proberly complicated methods (including HEADER emulating in a session to fake POST send the file).

The following script is not strictly PHP but your own personal takeupload.php script variations can be made to suit any POST data you wish to send, The form used is only an example of the different aspects of FORM features most commonly used today.

Enjoy :) <SCRIPT language="JavaScript">
function OnSubmitForm()
{
  if(document.pressed == 'Site1')
  {
   document.myform.action ="http://www.sitesome2.com/takeupload.php";
  }
  else
  if(document.pressed == 'Site2')
  {
    document.myform.action ="http://www.sitesome.com/takeupload.php";
  }
  return true;
}
</SCRIPT>

<div align=Center>

<form enctype="multipart/form-data"  name="myform" 
onSubmit="return OnSubmitForm();" method="post" target="inline">

<input type="hidden" name="MAX_FILE_SIZE" value="1024" />

<table border="1" cellspacing="0" cellpadding="10"><tr><td>

File <input type="file" name="file" size="40">&nbsp;&nbsp;
Another File! <input type="file" name="nfo" size="40"></tr><tr><td>
A title? <input type="text" name="name" size="70" />&nbsp;&nbsp;

<select name=\"type\">\n<option value=\"0\">(choose one)</option>
<option value='1'>Midgit Sky diving with ponys!</option>
</select>

</tr><tr><td colspan='2'>

<center>Large text area<br><textarea name='descr' rows='10' cols='100'>
</textarea>

</td></tr>

<tr><td align="center" colspan="2">

<INPUT TYPE="SUBMIT" name="Operation" 
onClick="document.pressed=this.value" VALUE="Site1">

<INPUT TYPE="SUBMIT" name="Operation" 
onClick="document.pressed=this.value" VALUE="Site2">

</td></tr>
</table>

</form>

<iframe name='inline' frameborder='1' width='600'  
height='350' src='' marginwidth='0' marginheight='0'></iframe>
(1) | by FaTe on January 23rd, 2008

An account is required to post comments and adaptations

Where u at? Get yo Groove On

COMMENTS AND ADAPTATIONS

Awesome. Thanks!

(unrated) | a comment by defproc on January 23rd, 2008

Why not have an array of URLs, and inline script in the page which generates buttons with names Site1 ... SiteX? Then disseminate the Value of the Submit button with a SubString to get the index of the array from which to take the URL. Then you can output the page with PHP and generate your array at runtime, and never have to worry about adding or removing buttons.

(unrated) | a comment by madkat on January 30th, 2008
We're coming out of the sidelines. | Powered by: Apache / PHP / MySQL | Made in Ninjapad NX | © defproc.co.uk, 2007_