0

I wanted a fancy upload bar for my website and felt this one's pretty cool I have had different problems but finally managed to upload.

Question : How do I get the path of the uploaded file to insert in my database?

2 Answers 2

1

In the function handle_file_upload in the upload.class.php file, after $file_path, I added:

$url = 'YOUR PATH HERE/files/'.$file->name; 

And then I included the $url var in my db insert. The YOUR PATH HERE would be whatever your structure is to get the /server/php/files/ directory.

Sign up to request clarification or add additional context in comments.

Comments

0

There is no way to get the file path as it is stored on the client machine (security issue).

You can get only the file name.

EDIT: Although some browsers (IE) may provide you with the path you cannot and should not rely on it.

2 Comments

I'm only interested in the file's path stored in server its usually "server/php/files/filename" How can I get the file name? I tried the $_FILES array but to no avail
I am no PHP genius but by the looks of it you need to use $HTTP_POST_FILES: php.net/manual/en/features.file-upload.php -- although $_FILES should also work (according to the link). A comment there suggests this: "If $_FILES is always empty, check the method of your form. It should be POST. Default method of a form is GET."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.