473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

questions about uploading file

Hi, all

I have two questions about uploading files using php & html:
1. How can i add a `file type' in the pop window when i click
`browse' button of the `<input type=file>'.
2. How can i get the local path of the uploading file. btw, i know
there's a $_FILE['userfile']['name'], but it only give me the name not
the path.

thx very much~~.

^_^ detrox

Dec 25 '06 #1
3 1371
You can use mime_content_type to determine the type of the file by its
name.

de****@gmail.com wrote:
Hi, all

I have two questions about uploading files using php & html:
1. How can i add a `file type' in the pop window when i click
`browse' button of the `<input type=file>'.
2. How can i get the local path of the uploading file. btw, i know
there's a $_FILE['userfile']['name'], but it only give me the name not
the path.

thx very much~~.

^_^ detrox
Dec 25 '06 #2
On question #2:

do a "print_r($_FILE);" in your script. This may give you the answer
your looking for ;)

-hackajar
de****@gmail.com wrote:
Hi, all

I have two questions about uploading files using php & html:
1. How can i add a `file type' in the pop window when i click
`browse' button of the `<input type=file>'.
2. How can i get the local path of the uploading file. btw, i know
there's a $_FILE['userfile']['name'], but it only give me the name not
the path.

thx very much~~.

^_^ detrox
Dec 25 '06 #3
de****@gmail.com wrote:
Hi, all

I have two questions about uploading files using php & html:
1. How can i add a `file type' in the pop window when i click
`browse' button of the `<input type=file>'.
2. How can i get the local path of the uploading file. btw, i know
there's a $_FILE['userfile']['name'], but it only give me the name not
the path.

thx very much~~.

^_^ detrox
Peter already answered your first question. As for the second one - you
can't. Such would be a huge security gap by exposing the user's file
structure.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Dec 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
9
by: R. Rajesh Jeba Anbiah | last post by:
Q: How should I handle file upload? A: File uploading requires HTML form of content type "multipart/form-data". The file content has to be POSTed/submitted via the form and once the file is...
5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
1
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
1
by: Tomas Vera | last post by:
Hello All, I have some questions about how the file upload process works in a web app. Background: The user is filling out a tech support request form. On the form is a file upload control so...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: wenqiang7 | last post by:
I am encountering a very strang problem with file uploading in my ASP.Net page. When we try to upload certain file, we'll get an error msg of "Cannot find server or DNS Error". We are running...
3
ganesanji
by: ganesanji | last post by:
hi all, I have written a php coding for uploading a file to a specific folder or location in server which is a Linux server. I think the coding for file uploaing is correct. But it does not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.