Problem with HTML in ASP.Net App

Discussion in 'ASP .Net' started by TCook, Jul 20, 2006.

  1. TCook

    TCook Guest

    Hey All,

    I have the following HTML:

    ' <form id="htmlupload" enctype="multipart/form-data" method="post"
    action="C:\Inetpub\wwwroot\FileUpload\upload.pl"
    ' <br>
    ' <INPUT type="file" name="htmlupload" value="G:\Satuit CRM\HTML
    Docs\Satuit IE Automation Prototype.doc">
    ' <br>
    ' <INPUT type="submit" value="Upload Default File" name="Upload via HTMl">
    ' </form>

    And I have the following CGI script:

    #!/usr/bin/perl
    use CGI;
    my $cgi = new CGI;
    my $dir = $cgi->param('dir');
    my $file = $cgi->param('file');
    $file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
    my $name = $2;
    open(LOCAL, ">$dir/$name") or die $!;
    while(<$file>) {
    print LOCAL $_;
    }
    print $cgi->header();
    print "$file has been successfully uploaded... thank you.\n";


    Why won't the file upload? Why won't the default value get used?

    Thanks & Regards,

    TC
     
    TCook, Jul 20, 2006
    #1
    1. Advertising

  2. TCook

    Hans Kesting Guest

    > Hey All,
    >
    > I have the following HTML:
    >
    > ' <form id="htmlupload" enctype="multipart/form-data" method="post"
    > action="C:\Inetpub\wwwroot\FileUpload\upload.pl"
    > ' <br>
    > ' <INPUT type="file" name="htmlupload" value="G:\Satuit CRM\HTML
    > Docs\Satuit IE Automation Prototype.doc">
    > ' <br>
    > ' <INPUT type="submit" value="Upload Default File" name="Upload via HTMl">
    > ' </form>
    >
    > And I have the following CGI script:
    >
    > #!/usr/bin/perl
    > use CGI;
    > my $cgi = new CGI;
    > my $dir = $cgi->param('dir');
    > my $file = $cgi->param('file');
    > $file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
    > my $name = $2;
    > open(LOCAL, ">$dir/$name") or die $!;
    > while(<$file>) {
    > print LOCAL $_;
    > }
    > print $cgi->header();
    > print "$file has been successfully uploaded... thank you.\n";
    >
    > Why won't the file upload? Why won't the default value get used?
    >
    > Thanks & Regards,
    >
    > TC


    *where* do you have that html? What does the html look like when you do
    a "view source" in the browser? Note: you can't have a form within a
    form.

    Do you get any errors? What are they?

    Is that perl-script activated? By the way: asp.net can also recieve
    uploaded files (see HtmlInputFile)

    The default value is ignored for security reasons.


    Hans Kesting
     
    Hans Kesting, Jul 20, 2006
    #2
    1. Advertising

  3. TCook

    Rob Meade Guest

    "TCook" wrote ...

    > Why won't the default value get used?


    If you mean the default value you've plonked into the <input type="file"...
    element, that would be because you can't do this.

    For security, you cant prepopulate a file/browse box with details from a
    client pc.

    You can get around this by using 3rd party components, some involve an
    active x control.

    Hope this helps.

    Rob
     
    Rob Meade, Jul 20, 2006
    #3
  4. TCook

    TCook Guest

    Hey Rob,

    Thanks for the info.

    What / where are these 3rd party components and ActiveX controls?

    Regards,

    Todd



    "Rob Meade" <> wrote in message
    news:%...
    > "TCook" wrote ...
    >
    >> Why won't the default value get used?

    >
    > If you mean the default value you've plonked into the <input
    > type="file"... element, that would be because you can't do this.
    >
    > For security, you cant prepopulate a file/browse box with details from a
    > client pc.
    >
    > You can get around this by using 3rd party components, some involve an
    > active x control.
    >
    > Hope this helps.
    >
    > Rob
    >
    >
     
    TCook, Jul 21, 2006
    #4
  5. TCook

    Rob Meade Guest

    "TCook" wrote ...

    > What / where are these 3rd party components and ActiveX controls?


    Hi Todd,

    We have been using SoftArtisans FileUp for a considerable amount of time now
    with no problems (www.softartisans.com) - the control that we've used to
    grab a file (either visibly or invisibly) from a client pc is called XFile.
    It relies on the client installing the activeX obviously, but if its for use
    within your organisation (like us) as opposed to a public www server it
    shouldn't be a hardship.

    Hope this helps.

    Regards

    Rob
     
    Rob Meade, Jul 21, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NGM
    Replies:
    0
    Views:
    2,343
  2. Dave Diehl
    Replies:
    4
    Views:
    835
    Dave Diehl
    Aug 11, 2004
  3. Rico
    Replies:
    0
    Views:
    414
  4. Headless Rider

    Control asp.net app from other asp.net app

    Headless Rider, Aug 18, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    125
    Headless Rider
    Aug 18, 2003
  5. JeffQ888
    Replies:
    0
    Views:
    211
    JeffQ888
    May 23, 2006
Loading...

Share This Page