Uploading file to a different web platform using ASP.NET/VB.NET and php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • brianinbox@gmail.com

    #1

    Uploading file to a different web platform using ASP.NET/VB.NET and php

    Hi, I've been trying to upload file using webclient.uploa dfile method
    from my IIS webserver to an Apache webserver without any success. On
    the Apache server (server that receives the incoming file) I have a
    simple php script, getFile.php to receive the file. The script look
    like this:

    <?php
    $uploadDir = '/var/www/Incoming/';
    $uploadFile = $uploadDir . $_FILES['userfile']['name'];
    print "<pre>";
    if (move_uploaded_ file($_FILES['userfile']['tmp_name'], $uploadFile))
    {
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES );
    }
    else
    {
    print "Error receiving file:\n";
    print_r($_FILES );
    }
    print "</pre>";
    ?>

    I know this script work perfectly if I use a standard html with <input
    type="file"> method. However, file needs to be sent from an
    asp.net page instead of html. People on the newsgroup have been
    suggesting me to use webclient.uploa dfile method, however, I just could
    not get it to work.

    Perhaps there is something wrong with my php script or maybe there
    something else needs to be done to the webclient. If anybody has came
    across with the similar situation, can you show me how to do it both on
    the ASP.NET side and php side (or perl)


    Thanks
    Brian

  • JDS

    #2
    Re: Uploading file to a different web platform using ASP.NET/VB.NET and php

    On Tue, 08 Mar 2005 06:43:39 -0800, brianinbox wrote:
    [color=blue]
    > I know this script work perfectly if I use a standard html with <input
    > type="file"> method. However, file needs to be sent from an
    > asp.net page instead of html. People on the newsgroup have been
    > suggesting me to use webclient.uploa dfile method, however, I just could
    > not get it to work.
    >
    > Perhaps there is something wrong with my php script or maybe there
    > something else needs to be done to the webclient. If anybody has came
    > across with the similar situation, can you show me how to do it both on
    > the ASP.NET side and php side (or perl)[/color]

    Huh? Are you saying that the web page in which the form that the user will
    interact with is generated on an ASP.NET server? And that the
    form's action="" points to a PHP script on an Apache server?

    Ultimately, my understanding is that the ASP.NET page sent to the browser
    is just plain 'ol HTML. So why can't you just get the ASP page to generate
    the appropriate HTML?

    Do this: Compare the final versions of each page -- the HTML one that
    works and the ASP.NET one that doesn't. If there are any differences,
    then there is your problem.

    later...

    --
    JDS | jeffrey@example .invalid
    | http://www.newtnotes.com
    DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

    Comment

    • brianinbox@gmail.com

      #3
      Re: Uploading file to a different web platform using ASP.NET/VB.NET and php

      The user interact with an ASP.NET form and on that form it has many
      other asp.net webcontrols. The action does not point to a php script
      on an Apache server.
      After user click the "Upload" button, the request is sent back to the
      IIS server and then post the file from user's machine to an Apache
      server.

      Comment

      • JDS

        #4
        Re: Uploading file to a different web platform using ASP.NET/VB.NET and php

        On Tue, 08 Mar 2005 09:13:32 -0800, brianinbox wrote:
        [color=blue]
        > After user click the "Upload" button, the request is sent back to the
        > IIS server and then post the file from user's machine to an Apache
        > server.[/color]

        Why? Why not just send the request directly to the Apache server?

        --
        JDS | jeffrey@example .invalid
        | http://www.newtnotes.com
        DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

        Comment

        Working...