send file in http (Upload from client store in server)
I am looking for a solution to upload multiple files from browser to server. As of now the HTML pages are written in oracle HTTP toolkit (using oracle mod_plsql on Windows NT).
Can someone suggest me solution to upload files from client side and process 开发者_运维问答it in server. Solutions based on HTML, Oracle HTTP, PHP are fine. Links and suggestions are greatly appreciated.
You know about http://de.php.net/manual/en/features.file-upload.php ?
You could use something like this, but I would suggest adding a lot more validation.
<?php
switch ($_REQUEST['mode']
case 'upload':
$ourpath = "/ourfolder/uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "You have uploaded". basename( $_FILES['uploadedfile']['name']);
} else{
echo "There was an error uploading the file, please try again!";
}
break;
default:
?><form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Select a File: <input name="uploadedfile" type="file" /><br />
<input type="hidden" name="mode" value="upload" />
<input type="submit" value="Submit" />
</form>
<?php
}
?>
精彩评论