Grow your CSS skills. Land your dream job.

Help Creating a Upload File Form.

  • # May 7, 2010 at 10:27 am

    Upload Form keeps saying INCORRECT FUNCTION. When trying to Upload…
    This is what I have so far : http://www.promoteyourteam.com/Articles.asp?ID=143

    Article HTML:

    Code:
    Type (or select) Filename:


    PHP File on FTP:

    Code:



    < ?php

    if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
    "http://www.promoteyourteam.com/v/vspfiles/templates/fade/uploads/uploads/{$_FILES['uploadFile'] ['name']}") )
    { print '

    The file has been successfully uploaded ‘;
    }
    else
    {
    switch ($_FILES[‘uploadFile’] [‘error’])
    { case 1:
    print ‘

    The file is bigger than this PHP installation allows

    ‘;
    break;
    case 2:
    print ‘

    The file is bigger than this form allows

    ‘;
    break;
    case 3:
    print ‘

    Only part of the file was uploaded

    ‘;
    break;
    case 4:
    print ‘

    No file was uploaded

    ‘;
    break;
    }
    }

    ?>

    # May 10, 2010 at 1:41 pm

    Can anyone help me with this?????????

    # May 10, 2010 at 8:44 pm

    Are you trying to use PHP on an ASP page? I’m not sure that works…

    Wufoo has simple file upload fields for their forms:
    http://wufoo.com

    This is also awesome, but ultimately relies on PHP also.
    http://www.uploadify.com/

    # May 11, 2010 at 3:50 am

    How can you tell if the site is ASP?

    Just last week, we had a client who wanted to make an endless amount of changes ( darn you upper management *waves fist*). We had finally finished everything they wanted and so we went live. Moved the files from my site to theirs. Turns out they run ASP and none of our PHP worked. It was mass hysteria as we were working to do everything ASP compatible (as we were doing this they decided they wanted more changes).

    It was ridiculous. Anyways, back to the question (sorry for the rant, it was the most frustrating client ever), it would be nice to not have to go through this again. I could always ask the client but clients aren’t often too bright this stuff. Anyway to see what it is remotely?

    # May 11, 2010 at 4:33 am
    "noahgelman" wrote:
    How can you tell if the site is ASP?

    That would be the ‘.asp’ file extension on the page.

    # May 12, 2010 at 11:13 am

    As long as the server that hosts the PHP file supports PHP it should work fine with the changes below:

    HTML form

    Code:
    Type (or select) Filename:


    PHP file

    Code:
    if (move_uploaded_file($_FILES[‘uploadFile’][‘tmp_name’], “uploads/”.$_FILES[‘uploadFile’][‘name’])) {
    print ‘

    The file has been successfully uploaded

    ‘;
    } else {
    switch ($_FILES[‘uploadFile’][‘error’]) {
    case 1:
    print ‘

    The file is bigger than this PHP installation allows

    ‘;
    break;
    case 2:
    print ‘

    The file is bigger than this form allows

    ‘;
    break;
    case 3:
    print ‘

    Only part of the file was uploaded

    ‘;
    break;
    case 4:
    print ‘

    No file was uploaded

    ‘;
    break;
    }
    }

    You need the enctype="multipart/form-data" attribute set on the form, and there were some syntax errors with your PHP.

    # May 12, 2010 at 11:20 am

    Thanks for the responses/help… Yeah i updated the form and PHP it still says "incorrect function"..I’m assuming that the server doesn’t support PHP..I will find out..we are using Volusion CMS..I know they use .asp for dynamic pages..Is there any alternative way to setup a upload area for clients to upload artwork that doesn’t require PHP? I talked to volusion and they said there is no way around it I would have to create a FTP account and hand it to my clients… How is this not possible to have a simple upload feature on our website grrr?

    # May 12, 2010 at 11:46 am

    Well, you could write your form handler in ASP if you don’t have access to a PHP enabled server.

    # May 12, 2010 at 12:07 pm
    "Tcooper" wrote:
    Well, you could write your form handler in ASP if you don’t have access to a PHP enabled server.

    wish i new asp :D but I found this..

    Code:



    and created a upload.asp file

    Code:
    < %
    Set Upload = Server.CreateObject("Persits.Upload.1")

    ' Upload files
    Upload.OverwriteFiles = False ' Generate unique names
    Upload.SetMaxSize 1048576 ' Truncate files above 1MB
    Upload.Save "vvspfilesuploadart"

    ' Process all files received
    For Each File in Upload.Files

    ' Save in the database as blob
    File.ToDatabase "DSN=data;UID=sa;PWD=zzz;", _
    "insert into mytable(blob) values(?)"

    ' Move to a different location
    File.Copy "vvspfilesuploadart" & File.ExtractFileName
    File.Delete
    Next

    ' Display description field
    Response.Write Upload.Form("Description") & "

    ‘ Display all selected categories
    For Each Item in Upload.Form
    If Item.Name = “Category” Then
    Response.Write Item.Value & “

    End If
    Next
    %>

    Still doesn’t work =/ just says Page can not be displayed..I dont get why it can’t be displayed its the correct location.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".