Jump to content

FIle Path


Nodral

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
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
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
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
Share on other sites

Using Apache, Windows XP and PHP 5.2.13

 

My web host is the same except for they use php 5.3.

 

I'm unsure how to set up read/write access on the folder, but I've never had an issue with any other folders I've created through windows

Link to comment
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.