hello! I am using php and i have written codes to allow a user upload a file. For testing purposes, i have saved the file to D:/final/temp/test.xls.
Then i generate another file and save it to the same location. This file can be downloaded by the user.
But if an actual user would be using my application,
where should the location point to? Thanks!
views:
43answers:
1
+1
A:
You need to upload the file to a directory which is being served by your web server. You have 3 options:
- Find the directory where your PHP files are being served and save the files to that location, or a directory underneath.
- In your web server config, map the D:/final/temp/ directory to a website or virtual directory.
- Create a PHP file that reads the file from the D:/final/temp directory and serves it to the end user. This option is trickier to setup and has more gotchas in terms of performance.
The location which you upload to needs to have write permissions, and the web server also needs to be able to read files from this location.
BrianLy
2010-04-07 16:14:30
I tried to save the file to C:/xampp/htdocs/foldername/tmp. but i am having an error : you may be trying to access a read only location.
chupinette
2010-04-07 16:22:29
You need to set the permissions on C:/xampp/htdocs/foldername/ to let you write files to that location. On Windows you can right-click a directory in Explorer and go to Properties->Permissions. The user which the web server is running as needs to have permission to write to the directory. You can find the user by looking at the processes view in Task Manager. If configured as a service look at the Service Manager properties for the service.
BrianLy
2010-04-07 17:42:02