php - set folder into directory -


I'm making an app to upload the file to the system but here, I'm facing a problem. The folder is properly created as I want, but when I click the upload button, the file is not saved in the folder as I have set it as a goal. Below is my syntax < Previous> $ id = $ _ session ['subject']; $ Target_path = mkdir ("doc_student / $ id", '0777'); $ Target_path = $ target_path basename ($ _ files ['uploadedFile'] ['name']); If (move_uploaded_file ($ _ files ['uploaded file'] ['tmp_name'], $ target_path)) {resonant "file" basename ($ _FILES ['uploaded file'] ['name']). "Uploaded"; } Else {echo "error while uploading this file"; }

Returns TRUE success or FALSE on failure. If you assign the $ target_path to the mkdir function, then the variable gets boolean, try it,

  $ target_path = "doc_student / $ Id "; If (! Is_dir ($ target_path)) {MKDIR ($ target_path, '0777'); } Instead of   

  $ target_path = mkdir ("doc_student / $ id", '0777');    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -