I want to get the absolute path of my upload, but only get the file name, and template file! Help how to get the absolute path I upload.

Source: Internet
Author: User

Reply to discussion (solution)

The absolute path is on the uploader's machine, what's the matter with you?
You just have to deal with the documents you received.

Do not know what you want to get that path to do, really want to get, with JS try.

The absolute path is on the uploader's machine, what's the matter with you?
You just have to deal with the documents you received.

I want to get the absolute path, then format the conversion, and sometimes someone else may be uploading a execl file. But Execl can't handle it, I have to convert it to CSV format in order to handle it.

Do not know what you want to get that path to do, really want to get, with JS try.

PHP has no corresponding method can be obtained, should just transfer php not long. No correspondence was found on the Internet.

You are in Beijing, I am in Shanghai, if I upload an Excel file, then do you want to turn him into a CSV file on my machine?

When the file is uploaded, it is stored in the default temp directory on the server side by default, unless the Upload_tmp_dir in php.ini is set to a different path. The default temp directory on the server can be reset by changing the environment variable TMPDIR of the PHP runtime environment
If there is no way to find out the directory, you can use the Move_uploaded_file dump and then do the processing, in fact, there is no need to know that directory, direct transfer and then processed.

You must use JS to get the value of the input box into a hidden field, and then commit it together.

Don't get complicated, you can prompt the user to upload a CSV file.

You are in Beijing, I am in Shanghai, if I upload an Excel file, then do you want to turn him into a CSV file on my machine?

It must have been done on his side, as you say. But I need now not the file, but the data inside the file, directly after the local import data into the database.

You must use JS to get the value of the input box into a hidden field, and then commit it together.

Don't get complicated, you can prompt the user to upload a CSV file.

I did that earlier, the manager is hard to change to let others can also upload execl directly. I think with JS how to achieve the.

Even if you get the local path of the file, can you use JS to modify his local file?

When the file is uploaded, it is stored in the default temp directory on the server side by default, unless the Upload_tmp_dir in php.ini is set to a different path. The default temp directory on the server can be reset by changing the environment variable TMPDIR of the PHP runtime environment
If there is no way to find out the directory, you can use the Move_uploaded_file dump and then do the processing, in fact, there is no need to know that directory, direct transfer and then processed.

This method (Move_uploaded_file) can not be used here, he seems to be the server generated cache files, if it is uploaded execl, will also be in advance will turn, if the turn. The data will be incorrect. So I think after the upload is done, click OK, I first convert the execl file to CSV format, and then directly use it, the program does not need to change. I try to use JS first try. There's a lot more to learn, but the theory you just said. It's very useful to me, thank you.

Even if you get the local path of the file, can you use JS to modify his local file?

Use PHP code to regenerate a CSV file. I've tried it, I can.

Then you can judge the type of the uploaded file (that temporary file) is OK, if the type is EXECL type, then use PHP to turn

What would you like to do??? Uploading a file generates a temporary file name operation. PHP has a Check type function you put the cart before the horse.

The browser does not give the Web page access to local data, you can only upload Excel files directly to the server temporary directory, and then the server processing files, processing and then import the database.
This is the only way.


When the file is uploaded, it is stored in the default temp directory on the server side by default, unless the Upload_tmp_dir in php.ini is set to a different path. The default temp directory on the server can be reset by changing the environment variable TMPDIR of the PHP runtime environment
If there is no way to find out the directory, you can use the Move_uploaded_file dump and then do the processing, in fact, there is no need to know that directory, direct transfer and then processed.

This method (Move_uploaded_file) can not be used here, he seems to be the server generated cache files, if it is uploaded execl, will also be in advance will turn, if the turn. The data will be incorrect. So I think after the upload is done, click OK, I first convert the execl file to CSV format, and then directly use it, the program does not need to change. I try to use JS first try. There's a lot more to learn, but the theory you just said. It's very useful to me, thank you.


Aren't you uploading files? How can this function not be used? This function is dedicated for uploading and is not available elsewhere. You can move to the target position where you can move it, and then you're free to handle it.


Even if you get the local path of the file, can you use JS to modify his local file?

Use PHP code to regenerate a CSV file. I've tried it, I can.


Can you use JS to modify the files on the user's computer??? Miracle ...

You want to let the user enter multiple data, and then save to the database.
If you can work with Excel and get the Excel file uploaded by the user, extract the data directly from the Excel file through the daemon and save it.
If you can't work with Excel, don't let users upload Excel files into other data formats that you can work with, such as typing directly into the form or uploading txt files in a fixed format.

As for obtaining the absolute path of the user's uploaded files in the user's computer, don't think about it, even if you get it, you can't manipulate the files on the user's computer.



Even if you get the local path of the file, can you use JS to modify his local file?

Use PHP code to regenerate a CSV file. I've tried it, I can.


Can you use JS to modify the files on the user's computer??? Miracle ...

You want to let the user enter multiple data, and then save to the database.
If you can work with Excel and get the Excel file uploaded by the user, extract the data directly from the Excel file through the daemon and save it.
If you can't work with Excel, don't let users upload Excel files into other data formats that you can work with, such as typing directly into the form or uploading txt files in a fixed format.

As for obtaining the absolute path of the user's uploaded files in the user's computer, don't think about it, even if you get it, you can't manipulate the files on the user's computer.


Upstairs positive solution
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.