Hey guys i have 2 scripts with me for file upload.
One is amazon s3 upload script. Using this script i can upload from computer. Another one is normal remote upload script.
I would like to implement remote upload feature in amazon s3.
This is the code what i have in “direct upload script”.
Html code
h1>Upload a file</h1>
<p>Please select a file by clicking the 'Browse' button and press 'Upload' to start uploading your file.</p>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input name="theFile" type="file" />
<input name="Submit" type="submit" value="Upload">
</form>
PHP code to retreive post variables
$fileName = $_FILES['theFile']['name'];
$fileTempName = $_FILES['theFile']['tmp_name'];
My remote upload script code is as follows.
<form method="POST" action="<?=$self?>">
<input type="text" name="file[]" size="45" value="">
<input name="submit" type="submit" id="submit" value="submit"></p>
</form>
php code to receive files
$files = $_POST['file'];
This is my question. How to convert my remote upload code
$files = $_POST[‘file’];
into
$fileName = $_FILES[‘theFile’][‘name’];
$fileTempName = $_FILES[‘theFile’][‘tmp_name’];
Hope you guys get my point. Thanks
You must set the
enctypeparameter on the<form>tag:Some more help is in the PHP manual: http://www.php.net/manual/en/features.file-upload.post-method.php
See specifically the second example.