Thank you! A problem occurs when you create a project named php. you want to perform operations on uploaded files, such as splitting, should I upload the file before performing operations, or should I split the file before uploading? Php does not seem to be able to obtain the absolute path of the file.
Reply to discussion (solution)
Php cannot access the files on the client. of course, the files are uploaded before processing.
Uploading is being processed first. how does php process uploaded files?
Php cannot access the files on the client. of course, the files are uploaded before processing.
Uploading is being processed first. how does php process uploaded files?
Learning is necessary for http://www.w3school.com.cn/php/php_file_upload.asp
Php cannot access the files on the client. of course, the files are uploaded before processing.
I don't mean how to upload files. it means that files have been uploaded and how to operate files on the server.
You didn't say anything. how do I know what you want to do?
You didn't say anything. how do I know what you want to do?
For example, if I want to split a file, how does php split the uploaded file after the file is uploaded using a form as you said?
$ Filename = 'name of the file you want to split '; $ cutsize = 1024; // The size of each file after splitting $ size = file_size ($ filename ); $ fp = fopen ($ filename, 'RB'); $ I = 0; do {$ buf = fread ($ fp, $ size); file_put_contents (str_replace ('. '. "_ $ I. ", $ filename), $ buf); $ I ++;} while (strlen ($ buf) ==$ size); fclose ($ fp );
$ Filename = 'name of the file you want to split '; $ cutsize = 1024; // The size of each file after splitting $ size = file_size ($ filename ); $ fp = fopen ($ filename, 'RB'); $ I = 0; do {$ buf = fread ($ fp, $ size); file_put_contents (str_replace ('. '. "_ $ I. ", $ filename), $ buf); $ I ++;} while (strlen ($ buf) ==$ size); fclose ($ fp );
Moderator, I have made this.
I have made the code for both file upload and file splitting.
But how to split uploaded files?
I uploaded the file and found that the absolute path of the file cannot be obtained, so the file cannot be split.
So how do you receive the upload?
So how do you receive the upload?
My upload is to select a file in the form browser box. However, the input shows that the file name is not an absolute path. my file splitting can only be performed on local files, that is, the file name specified in the code (absolute path)
$ _ FILES?
All the information of the uploaded file is in it.
$ _ FILES?
All the information of the uploaded file is in it.
$ _ FILES ['myfile'] ['name'] displays the original name of the client file and cannot obtain the absolute path.
After uploading, can the file name be split? Is the file operation completed by php after the upload?
$ _ FILES ['myfile'] ['tmp _ name'] indicates the uploaded file name.
$ _ FILES ['myfile'] ['tmp _ name'] indicates the uploaded file name.
So after the upload, you can perform operations on $ _ FILES ['myfile'] ['tmp _ name? Is the split file stored on the server?
Of course, it's on the server. can you write it to the user's machine?
Of course, it's on the server. can you write it to the user's machine?
Thank you, moderator !! I will continue to study hard !!
Haha, the moderator is in a hurry.
Try and you will understand it.
Haha, the moderator is in a hurry.
Try and you will understand it.
I just learned it for a while. The moderator is so patient. haha, good people are safe in their life.