Error while uploading file in PHP -


While uploading the file to PHP, I am not able to upload all types of files, if a file is filename In the meantime is not able to download. Anyone can correct this code

This is my upload code

   

check and verify something on file upload

below The script provided can help you:

  // 5MB maximum file size $ MAXIMUM_FILESIZE = 5 * 1024 * 1024; // Valid file extensions (images, words, excel, powerpoint) $ rEFileTypes = "/ ^. (Jpg | jpeg | gif | png | doc | docx | txt | rtf | pdf | xls | xlsx | ppt | pptx] { $} $ / I "; $ Dir_base =" / your / file / location / "; $ IsFile = is_uploaded_file ($ _ files ['filadata'] ['tmp_name']); If ($ isFile) // Do we have Is there a file? {// sanatize file name // - Delete / delete extra spaces to _, // - Delete non-0-9A-Z. _-Characters, // - leading / trailing spaces Remove // ​​Check that below 5 MB, // check the legal file type File extensions for $ safe_filename = preg_replace (array ("/ \ s + /", "/[^-\.\w] + /"), array ("_", ""), trim ($ _ files) ['Filedata'] ['name']); if ($$ _FILES ['filedata'] ['size'] <= $ MAXIMUM_FILESIZE & amp; preg_match ($ rEFileTypes, strrchr ($ secure_filname, '.' )) {$ IsMove = move_uploaded_file ($ _FILES ['filedata'] ['Tmp_name'], $ dir_base. $ Safe_filename);}}}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -