3

I have a website written in html/php on my server. I also have a script which loads a file and returns some graphs. I can load a file from my pc using <input type="file" (...)/>.

The problem is: I'd like to load files not from my hard drive but directly from the server - I mean files are already uploaded, now I want people to be able to select files they want and analyse them with my script. Let's say they are at this location: /home/user/www/source/. How can I do it? Is there some smart function to replace <input>?

3 Answers 3

2

If all the files in a certain folder are valid then you can glob() them and create links or a select list. If you want to manipulate the contents of a file, you'll need to open it with PHP, read the contents, and output the data into html.

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

Comments

0

The images are stored on a harddrive, how about just using the img-tag?

Comments

0

After uploading the files, your script could append that file to a list of uploaded files... something like

file1.txt
file2.txt
data1.txt

Then you can use your script to dynamically list the files...

<?
$f = file ('uploads.txt');

print '<ul>';
for ($i=0; $i<count($f); $i++) {
    print '<li><a href="analyze.php?f='.$f[$i].'">'.$f[$i].'</a></li>';
}

print '</ul>';

?>

Of course, you'd have to put your graph creation code in analyze.php so that it returns the graph corresponding to the selected file.

Comments

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.