![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? form action="upload.php" method="POST" enctype="multipart/form-data" p span>Select photo:</span input type="file" name="photo" style="display:none;" input type="text" name="photoUrl" class="s1" / input type="button" class="s2" onClick="photo.disabled=false;photo.click();photoU rl.value=photo.value;photo.disabled=true" value="Browse" / /p /form |
#3
| |||
| |||
|
|
On Jun 10, 11:31 pm, GuangXiN <xvt... (AT) gmail (DOT) com> wrote: I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? form action="upload.php" method="POST" enctype="multipart/form-data" p span>Select photo:</span input type="file" name="photo" style="display:none;" input type="text" name="photoUrl" class="s1" / input type="button" class="s2" onClick="photo.disabled=false;photo.click();photoU rl.value=photo.value;photo.disabled=true" value="Browse" / /p /form turn the button into a anchor you can style that any way you want. |
#4
| |||
| |||
|
|
LukeK1980 (AT) gmail (DOT) com wrote: On Jun 10, 11:31 pm, GuangXiN <xvt... (AT) gmail (DOT) com> wrote: I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? form action="upload.php" method="POST" enctype="multipart/form-data" p span>Select photo:</span input type="file" name="photo" style="display:none;" input type="text" name="photoUrl" class="s1" / input type="button" class="s2" onClick="photo.disabled=false;photo.click();photoU rl.value=photo.valu e;photo.disabled=true" value="Browse" / /p /form turn the button into a anchor you can style that any way you want. Sorry, what I mean is the file upload element doesn't work. the file upload element's style cannot be set, so I make it unvisiable, but so it can't send a correct file upload request to web server. |
#5
| |||
| |||
|
|
GuangXiN wrote on 11 jun 2008 in comp.lang.javascript: LukeK1980 (AT) gmail (DOT) com wrote: On Jun 10, 11:31 pm, GuangXiN <xvt... (AT) gmail (DOT) com> wrote: I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? form action="upload.php" method="POST" enctype="multipart/form-data" p span>Select photo:</span input type="file" name="photo" style="display:none;" input type="text" name="photoUrl" class="s1" / input type="button" class="s2" onClick="photo.disabled=false;photo.click();photoU rl.value=photo.valu e;photo.disabled=true" value="Browse" / /p /form turn the button into a anchor you can style that any way you want. Sorry, what I mean is the file upload element doesn't work. the file upload element's style cannot be set, so I make it unvisiable, but so it can't send a correct file upload request to web server. "Doesn't work" is not an acceptable fraze in this NG, unless you explain what and how, what debugging tou did, and if and what errorstring and linenumbers you encountered. As a security measure, you cannot manipulate the input file element of html upload forms. Otherwise it would be too easy to secretly upload another file than the one shown and so compromize the user's private parts. |
#6
| |||
| |||
|
|
As a security measure, you cannot manipulate the input file element of html upload forms. Otherwise it would be too easy to secretly upload another file than the one shown and so compromize the user's private parts. OK, let me explain my words. I wrote a file upload component, but I cannot modify its sytle to what I want. So I added a textbox and a button with style, and then I make the file upload component hidden, I want to use script to simulate the file upload's "Browse" click. I am sure that file select dialog popup when I click the button. I select a image file, the path and filename did display in the textbox. |
|
But when I click submit, server side script caught no file. |
#7
| |||
| |||
|
|
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? form action="upload.php" method="POST" enctype="multipart/form-data" * *<p * * *<span>Select photo:</span * * *<input type="file" name="photo" style="display:none;" * * *<input type="text" name="photoUrl" class="s1" / * * *<input type="button" class="s2" onClick="photo.disabled=false;photo.click();photoU rl.value=photo.value;phot*o.disabled=true" value="Browse" / * *</p /form |
#8
| |||
| |||
|
|
GuangXiN wrote on 11 jun 2008 in comp.lang.javascript: As a security measure, you cannot manipulate the input file element of html upload forms. Otherwise it would be too easy to secretly upload another file than the one shown and so compromize the user's private parts. OK, let me explain my words. I wrote a file upload component, but I cannot modify its sytle to what I want. So I added a textbox and a button with style, and then I make the file upload component hidden, I want to use script to simulate the file upload's "Browse" click. I am sure that file select dialog popup when I click the button. I select a image file, the path and filename did display in the textbox. As I said, security could be compromized by that. The browser does not contemplate your possible good intentions. Is there any other way to implement what I need? I just need a file |
|
But when I click submit, server side script caught no file. Do serverside scripts catch files? Fire perhaps? PHP has an $_FILES arra. When submit with a file, it will be not null. |
#9
| |||
| |||
|
|
Evertjan. wrote: GuangXiN wrote on 11 jun 2008 in comp.lang.javascript: As a security measure, you cannot manipulate the input file element of html upload forms. Otherwise it would be too easy to secretly upload another file than the one shown and so compromize the user's private parts. OK, let me explain my words. I wrote a file upload component, but I cannot modify its sytle to what I want. So I added a textbox and a button with style, and then I make the file upload component hidden, I want to use script to simulate the file upload's "Browse" click. I am sure that file select dialog popup when I click the button. I select a image file, the path and filename did display in the textbox. As I said, security could be compromized by that. The browser does not contemplate your possible good intentions. Is there any other way to implement what I need? I just need a file upload component with customs style in css file. |
|
PHP has an $_FILES arra. When submit with a file, it will be not null. I tried to make the file upload component appear and I click the following button (NOT the Browse button in fileupload component). I can choose a file and the file upload component show its path correctly. I click submit and PHP shows that $_FILES is still null. |
#10
| |||
| |||
|
|
Of course. By disabling the file input control you have only caused only the encoded file path to be submitted per `photoUrl'. A file input control in a form causes the encoded content of the selected file to be submitted instead. And if it was possible to set the value of that control with scripting, any Web site you visit could upload any file from your computed without your knowing it; you do not want that to happen. (Using display:none as suggested will not change that.) |
![]() |
| Thread Tools | |
| Display Modes | |
| |