Upload files with Php
When it comes to upload files with php, it's not so difficult, In the beggining we just need to type some html markup
we just creating a form with
enctype="multipart/form-data"
it important to add this attribute it shows that we can upload file with this form
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
this hidden field indicate max file size , we need also to make security check in php side
<input name="userfile" type="file" />
this is the file input to upload a file
move_uploaded_file() : take 2 paramatres the filename and destination path/filewe just creating a form with
enctype="multipart/form-data"
it important to add this attribute it shows that we can upload file with this form
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
this hidden field indicate max file size , we need also to make security check in php side
<input name="userfile" type="file" />
this is the file input to upload a file
NB : this just uploading directly files ,but in the production mode wee need security checks such as allowed file extensions and allowed max file size
$_FILES it's multidimensional array variable hols all uploaded file info
$_FILES it's multidimensional array variable hols all uploaded file info
Comments
Post a Comment