tufanv Expert Licensed User Longtime User May 28, 2018 #1 Hello , I use the below code to upload files: Code: Dim MFD As MultipartFileData MFD.Initialize MFD.Dir = File.DirDocuments MFD.FileName = sen MFD.KeyName = "userfile" H.PostMultipart("",Null,Array(MFD)) H.PostMultipart("server",CreateMap("username":"b4x","password":"supersafe"),Array(MFD)) and php side is: Code: $uploaddir = '/home/www/uploads'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } if I dont set the upload dir chmod to 777 file is not being uploaded. Even 755 chmod is not enough. Chmod 777 may be a security risk for me so , what should I do with this ? Is there a reason I cant upload without chmod 777 ? TY
Hello , I use the below code to upload files: Code: Dim MFD As MultipartFileData MFD.Initialize MFD.Dir = File.DirDocuments MFD.FileName = sen MFD.KeyName = "userfile" H.PostMultipart("",Null,Array(MFD)) H.PostMultipart("server",CreateMap("username":"b4x","password":"supersafe"),Array(MFD)) and php side is: Code: $uploaddir = '/home/www/uploads'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } if I dont set the upload dir chmod to 777 file is not being uploaded. Even 755 chmod is not enough. Chmod 777 may be a security risk for me so , what should I do with this ? Is there a reason I cant upload without chmod 777 ? TY
Erel B4X founder Staff member Licensed User Longtime User May 28, 2018 #2 https://stackoverflow.com/a/25422452/971547 Upvote 0