Jump to content


Photo

moving non-uploaded files


  • Please log in to reply
1 reply to this topic

#1 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 05 September 2006 - 02:51 PM

I read in php manual that the move_uploaded_file function...

"checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism)."


Now I was wondering how to move a non-uploaded file as there is no move() function in php, I assume cause of security...
What I would like to do is move a file in FILES array to a temp folder on upload. Then while doing some other code, if I figure out it needs to be moved again, move_uploaded_file doesnt seem to want to move it (since i assume its not a uploadedfile in /temp folder anymore).

Anyone know a way past this? or should i just not move the file until i do all those 'code checks'.

I am probably going to do all my validation 1st, before uploading the file now... but I was thinking it would still be useful for move a non-uploaded file even though its a php security restriction probably? Because when a user uploads a file, I would like to move the uploaded file, but also move the orig file (if it exists), to an archive directory and call it, filename[0].fileExt .
I have seen php code that claims to do something like this, although I am not sure how they can move non-uploaded files.


#2 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 05 September 2006 - 02:53 PM

hmmm nvm i think i figured it out... rename function for moving files




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users