Problem with an upload form

B

bernhard.heinzel

Hi,

I got a little problem with an upload form. Everytime I post the form
it only submits the filename without the path. But I need the path.

So could anybody help?

Here is the code:

<p>New file.</p>
<form action='script.py' method='post'>
<table>
<tr><th>File</th><td>:</td><td><input type='file'
name='articlefilepath'></td></tr>
</table>
<p>
<input type='hidden' name='task' value='insertfile'>
<input type='submit' value='Insert Article'>
<input type='reset' value='Clear'>
</p>
</form>
 
L

Leif K-Brooks

I got a little problem with an upload form. Everytime I post the form
it only submits the filename without the path. But I need the path.

Stop needing that. Modern browsers won't send it. It would be a security
hazard.
 
J

jojo

I got a little problem with an upload form. Everytime I post the form
it only submits the filename without the path.

it does not only send the filename but the whole file...
But I need the path.

what would you do with the path if you could get it? you cannot read
local files..
So could anybody help?

Here is the code:

<p>New file.</p>
<form action='script.py' method='post'>
<table>
<tr><th>File</th><td>:</td><td><input type='file'
name='articlefilepath'></td></tr>
</table>

What's the need of that table? use the <label>-element here:

<form action='script.py' method='post'>
<label for='file'>File: </label>
 
J

Jukka K. Korpela

Scripsit Leif K-Brooks:
Stop needing that. Modern browsers won't send it. It would be a
security hazard.

It's more complicated than that. By the specs, a browser _may_ include the
filename in the submitted data; the meaning of "filename" is left
unspecified. And some browsers include the relative filename only (just the
"name part") whereas some browsers include a path name. Even if you get a
path name, what would you do with it? For all that you can know, it might
not be even a syntactically valid path name in the _server's_ file system.

As usual, asking _why_ the path name would be needed would probably get us
closer to the _real_ problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top