Jump to content

Recommended Posts

Hi

 

I'm desperately going round in circles here trying to work out a save path for a file.  Here is my structure.

 

localhost/dir1/dir2/files

 

I need to save in localhost/tmp

 

What file path do I set $filename as?

 

move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],
  "$filename"

Link to comment
https://forums.phpfreaks.com/topic/242340-file-path/
Share on other sites

Tried this and got the following errors

 

$filename="../../../tmp/user_import.csv";

 

Warning: move_uploaded_file(../../../tmp/user_import.csv) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\Documents\AI24\Web\skooch\pfp\uploadFile.php on line 11

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php427D.tmp' to '../../../tmp/user_import.csv' in D:\Documents\AI24\Web\skooch\pfp\uploadFile.php on line 11

 

 

Link to comment
https://forums.phpfreaks.com/topic/242340-file-path/#findComment-1244642
Share on other sites

This works fine if I save it in the same directory, or move up a level or 2 using ../ etc.

However, as soon as I add the tmp directory it falls over. 

This directory was manually created about 30 seconds before running the script.

It is to mirror the structure I will have when I move to my live server.

even the absolute path of $filename='localhost/tmp/user_import.csv'; fails

 

 

Link to comment
https://forums.phpfreaks.com/topic/242340-file-path/#findComment-1244647
Share on other sites

Warning: move_uploaded_file(localhost/tmp/user_import.csv) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\Documents\AI24\Web\skooch\pfp\uploadFile.php on line 11

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php4283.tmp' to 'localhost/tmp/user_import.csv' in D:\Documents\AI24\Web\skooch\pfp\uploadFile.php on line 11

 

 

Link to comment
https://forums.phpfreaks.com/topic/242340-file-path/#findComment-1244652
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.