I was searching a script to upload file from a local pc to web server. Then I found a script and trying to adjust with my script. But when I run the script I got an error. The error was - "The file you are trying to upload couldn't be copied to the server" or "Couldn't Copy File To Server ". So any body please can help me? How can I solve this problem? My code was like -
$absolute_path = "/home/www/docs/servername/uploads";
@copy($file, "$absolute_path/$file_name")
You can only copy from folder to folder on the server, if the file is not uploaded yet, then this will fail...Read the manual section on file uploads to see how it works...
thanks for mail. May I ask you another question. I'm trying to uplaod file by uisng ftp_connect. This is working fine but I cann't upload big size file. Like i want to upload more then 2 mb file. So how can I upload this. my ftp command is like this -
saymabastien wrote:
>
> You can only copy from folder to folder on the server, if the
> file is not uploaded yet, then this will fail...Read the
> manual section on file uploads to see how it works...
There is a setting in the ini file that controls the max size of the upload. The default setting is 2M. Simply open the ini file with a text editor and reset the size to something larger
Hi thanks for your reply. May I ask you one thing how can I do this. Cause I can't find the defualt setting for file size. Cause I don't have enough idea abt this. Please waiting for your reply.
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use
system default if not
; specified).
;upload_tmp_dir = <-- is this place used for upload file by HTTP? if yes then what will be the value? How can I set this. I think thats why my copy function is not working. Could you please tell me?
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M <--change this value
upload_tmp_dir depends on the server set up that is available. consult the sysadmin for more details as to where the files are allowed to go temporarily.
It should be any folder on the file system. ensure that the folder has permission to be written to.