HtmlInputFile issue

P

PK

Hi,
I've a HtmlInputFile control in my aspx file. I browsed Winword.exe from the
Program files dir and included that file in that HtmlInputFile control. I
use that HtmlInputFile control to just get the path of the applications that
is used in a domain. This path information, I'm storing it in the database.
I don't process the exe or anything.

When I add Winword or Excel or PowerPoint in that control, I get the 'Page
cannot be displayed' message. When I add anyother exe, it works fine. Please
help.

Thanks,
Meena
 
P

PK

Hi,
I know that we cannot upload a file that is bigger than 4MB using
HtmlInputFile control. I'm not uploading the file. I just use that control
like a Open File Dialog(in Winforms) to get the path of the application.
Is there anything I can do about this ?

Meena
 
M

Mythran

PK said:
Hi,
I've a HtmlInputFile control in my aspx file. I browsed Winword.exe from
the
Program files dir and included that file in that HtmlInputFile control. I
use that HtmlInputFile control to just get the path of the applications
that
is used in a domain. This path information, I'm storing it in the
database.
I don't process the exe or anything.

When I add Winword or Excel or PowerPoint in that control, I get the 'Page
cannot be displayed' message. When I add anyother exe, it works fine.
Please
help.

Thanks,
Meena

This is because:

Winword.exe : 10.1 MB
Excel.exe : 8.76 MB
Powerpnt.exe: 5.71 MB

When you use the HtmlInputFile control, the client will upload the file to
the server. If the file is greater than the server will allow, you will get
a 'Page cannot be displayed' message.

HTH solve your problem,
Mythran
 
P

PK

Hi,
I know that we cannot upload a file that is bigger than 4MB using
HtmlInputFile control. I'm not uploading the file. I just use that control
like a Open File Dialog(in Winforms) to get the path of the application.
Is there any control that can act as an Open File Dialog control? I don't
want to use HtmlInputFile control that acts as an Upload control.

Meena
 
M

Mythran

PK said:
Hi,
I know that we cannot upload a file that is bigger than 4MB using
HtmlInputFile control. I'm not uploading the file. I just use that control
like a Open File Dialog(in Winforms) to get the path of the application.
Is there any control that can act as an Open File Dialog control? I don't
want to use HtmlInputFile control that acts as an Upload control.

Meena

Here is a hack you *might* be able to use :)

<script language=javascript>
function Form_OnSubmit()
{
var hiddenField = document.getElementById("HiddenFieldIdHere");
var fileUpload = document.getElementById("FileUploadIdHere");

hiddenField.value = fileUpload.value;
fileUpload.disabled = true;
}
</script>


The above snip would place the path into the hidden field and not upload the
file to the server. You would need to write the code-behind to fetch from
this hidden field though. (hint: use runat=server and define the hidden
control).

HTH,
Mythran
 
P

PK

Thanks a lot.

Mythran said:
Here is a hack you *might* be able to use :)

<script language=javascript>
function Form_OnSubmit()
{
var hiddenField = document.getElementById("HiddenFieldIdHere");
var fileUpload = document.getElementById("FileUploadIdHere");

hiddenField.value = fileUpload.value;
fileUpload.disabled = true;
}
</script>


The above snip would place the path into the hidden field and not upload the
file to the server. You would need to write the code-behind to fetch from
this hidden field though. (hint: use runat=server and define the hidden
control).

HTH,
Mythran
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top