Ask a Question related to Macromedia Contribute General Discussion, Design and Development.

  1. #1

    Default Uploading Files

    Hi,

    Can someone point me in the right direction for how I can upload a file to
    the server, and overwrite the existing file if there is one.

    Thanks.


    Sammy the Bull Guest

  2. Similar Questions and Discussions

    1. Problems: uploading files have Chinese named files
      Hi everyone, I try to upload file by using asp.net, code like that: <script language="VB" runat="server"> Sub Upload(Source As Object, e As...
    2. [PHP] Uploading files via SSH
      Google for "Failed to scan directories. Error 6" (including quotes). First result is the ssh.com faq, which has a link to...
    3. Uploading files in C#
      why don't you examine the extension of the file being loaded. "Ian Walsh" <ianwalsh@hbosplc.com> wrote in message...
    4. Uploading Files - help please
      When you use: <Input ID="ImageUpload" Type="File" visible="false" RunAt="Server"> Is their any way you can make a starting value appear inside...
    5. Uploading files using FTP in ASP.NET
      If you follow this link, you'll find a few ftp samples: http://www.gotdotnet.com/community/usersamples/Default.aspx?query=ftp Here's one that...
  3. #2

    Default Re: Uploading Files

    Go to [url]www.aspfaq.com[/url] and enter this search phrase:
    How do I upload files from the client to the server?

    Ray at work

    "Sammy the Bull" <sendmelotsofspam@spam.com> wrote in message
    news:%23qUUSlPXDHA.2312@TK2MSFTNGP10.phx.gbl...
    > Hi,
    >
    > Can someone point me in the right direction for how I can upload a file to
    > the server, and overwrite the existing file if there is one.
    >
    > Thanks.
    >
    >

    Ray at Guest

  4. #3

    Default Re: Uploading Files



    Sammy the Bull wrote:
    >
    > Hi,
    >
    > Can someone point me in the right direction for how I can upload a file to
    > the server, and overwrite the existing file if there is one.
    I've found that ASPFaq.com blows the socks off of MS docs:

    [url]http://www.aspfaq.com/2189[/url]

    I've just tried freeaspupoad, it works for me and comes in under budget.

    Cheers,
    Jeff
    >
    > Thanks.
    Jeff Thies Guest

  5. #4

    Default Re: Uploading files

    >
    > file_uploads = 1
    > upload_max_filesize = 2M
    > upload_tmp_dir = c:\Temp (tried c:\\Temp, too)
    > post_max_size = 8M
    >
    Try C:/Temp

    Joshua Ghiloni Guest

  6. #5

    Default Re: Uploading files

    Joshua Ghiloni <jdg11@SPAM.ME.AND.DIE.cwru.edu> wrote in
    news:bhjdam$9sg$1@eeyore.INS.cwru.edu:
    >>
    >> file_uploads = 1
    >> upload_max_filesize = 2M
    >> upload_tmp_dir = c:\Temp (tried c:\\Temp, too)
    >> post_max_size = 8M
    >>
    >
    > Try C:/Temp
    >
    Same results.

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  7. #6

    Default Re: Uploading files

    Also sprach Terry Austin:
    > Joshua Ghiloni <jdg11@SPAM.ME.AND.DIE.cwru.edu> wrote in
    > news:bhjdam$9sg$1@eeyore.INS.cwru.edu:
    >
    >>>
    >>> file_uploads = 1
    >>> upload_max_filesize = 2M
    >>> upload_tmp_dir = c:\Temp (tried c:\\Temp, too)
    >>> post_max_size = 8M
    >>>
    >>
    >> Try C:/Temp
    >>
    > Same results.
    Try "c:\Temp\" (Slash at the end!)

    --



    Thomas Mlynarczyk Guest

  8. #7

    Default Re: Uploading files

    "Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote in
    news:bhjhjn$lp0$00$1@news.t-online.com:
    > Also sprach Terry Austin:
    >
    >> Joshua Ghiloni <jdg11@SPAM.ME.AND.DIE.cwru.edu> wrote in
    >> news:bhjdam$9sg$1@eeyore.INS.cwru.edu:
    >>
    >>>>
    >>>> file_uploads = 1
    >>>> upload_max_filesize = 2M
    >>>> upload_tmp_dir = c:\Temp (tried c:\\Temp, too)
    >>>> post_max_size = 8M
    >>>>
    >>>
    >>> Try C:/Temp
    >>>
    >> Same results.
    >
    > Try "c:\Temp\" (Slash at the end!)
    >
    Same results.

    I've checked permissions on the directory, and
    re-entered them to be sure. At the moment, "Everyone" as "Full Control"
    permissions, which should cover it

    I tried turning on auditing on file events, and tried an upload. I'm seeing
    a series of events with User Administrator in C:\Temp (which is what's
    specified in php.ini), which is me playing with Explorer. And I see a
    series of events with User System in C:\WINNT\Temp involving a file called
    _246_166_2.wrk, with the same Process ID as the file accesses in the
    directory the upload script is in. So it looks like, for some reason,
    either Apache or PHP (whichever is handling the writing of the temp file)
    is not putting the temp file in the right place (assuming that .wrk file is
    the temp file). But it's looking for it in the right place when the script
    later tries to move it?

    And there are no failed events, only successful ones, from what looks like
    changing in to the directly to writing the file, to reading the directory
    information, to reading the file, to deleting the file.

    Now, I'm very confused.

    Why would it put the temp file in c:\winnt\temp (which is the system temp
    directory) instead on the explicitly assigned temp directory in php.ini?
    And why would it then not be able to find it?

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  9. #8

    Default Re: Uploading files

    Have you tried just to echo the elements of $_FILES[]? It should give you
    the temp path being used.


    Thomas Mlynarczyk Guest

  10. #9

    Default Re: Uploading files

    "Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote in
    news:bhkmnm$akr$03$1@news.t-online.com:
    > Also sprach Terry Austin:
    >
    >>> Try "c:\Temp\" (Slash at the end!)
    >
    >> Same results.
    >
    > Maybe you forgot a temp directory setting somewhere? Try removing all
    > your temp dir settings and see if it works with the defaults.
    Tried that. Same result.
    > Which is
    > the exact code you are using (copy&paste!)?
    >
    Everything is pretty much copy&pasted from the manual, with paths adjusted
    as necessary.

    The form is:

    <form enctype="multipart/form-data" action="upload.php" method="post">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000">
    Send this file: <input name="userfile" type="file">
    <input type="submit" value="Send File">
    </form>

    (the file I've been testing with is about 3.5k)

    upload.php is:

    $uploaddir = "c:\Temp";
    print "<pre>";
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .
    $_FILES['userfile']['name'])) {
    print "File is valid, and was successfully uploaded. Here's some more
    debugging info:\n";
    print_r($_FILES);
    } else {
    print "Possible file upload attack! Here's some debugging info:\n";
    print_r($_FILES);
    print $_FILES['userfile']['error'];

    The print_r produces:

    Array
    (
    )

    the other print produces nothing at all.

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  11. #10

    Default Re: Uploading files

    "Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote in
    news:bhkmsl$r6r$04$1@news.t-online.com:
    > Have you tried just to echo the elements of $_FILES[]? It should give you
    > the temp path being used.
    >
    Is that what print_r($_FILES); does? All it produces is

    Array
    (
    )

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  12. #11

    Default Re: Uploading files

    "Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote in
    news:bhstno$cdq$02$4@news.t-online.com:
    > Also sprach Terry Austin:
    >
    >> $uploaddir = "c:\Temp";
    >
    > $uploaddir="C:/Temp/"; // Slash at the end!
    Double slash, that is. A single slash produces an error.
    >
    >> print "<pre>";
    >> if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .
    >> $_FILES['userfile']['name'])) {
    >> print "File is valid, and was successfully uploaded. Here's some more
    >> debugging info:\n";
    >> print_r($_FILES);
    >> } else {
    >> print "Possible file upload attack! Here's some debugging info:\n";
    >> print_r($_FILES);
    >> print $_FILES['userfile']['error'];
    >
    >> The print_r produces:
    >
    >> Array
    >> (
    >> )
    >
    > It seems the $_FILES array is empty. My only explanation is that some
    > server or php setting is preventing the upload.
    That is the conclusion I keep coming to. Except for the *.wrk files that
    show up when I turn on file access auditing in NT.
    > You said your config
    > was
    >
    >>> file_uploads = 1
    >>> upload_max_filesize = 2M
    >>> upload_tmp_dir = c:\Temp (tried c:\\Temp, too)
    >>> post_max_size = 8M
    >
    > which looks valid to me. I use "file_uploads = On"
    That's what is actually in php.ini. phpinfo was reporting it
    as "1". I upgraded from 4.2.2 to 4.3.2 yesterday, BTW (which
    does report it as On), with the same results.
    >and I don't specify
    > any upload_tmp_dir (commented out).
    Tried that, with the same results.
    >I don't know what other settings
    > might influence file uploads (I'm using WinXP, maybe NT4 is causing
    > the problem). Have you tried if other auto globals "work" or if this
    > concerns only $_FILES?
    Everything else seems to be working. I can POST form data without
    submitting file, and that works fine.

    Last night, I tried the same form and script on a 98 machine at home, but
    with the same version of Apache and PHP, and got the same results - I
    think. I'm beginning to think it's something in the OpenSA version of
    Apache that is handling the temp files incorrectly. I really didn't want to
    have to figure out how to manually configure SSL stuff. Sigh. I think I'll
    try uninstalling Apache completely, and rebuild it from scratch with an
    unaltered version from apache.org.
    >
    > Sorry that I can't be more helpful.
    >
    Oh, you've helped eliminate stuff it's not, which is something. Thanks for
    that, at least.

    I guess I need to become an expert on Apache and PHP. Story of my life.

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  13. #12

    Default Re: Uploading files

    "Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote in
    news:bhkmsl$r6r$04$1@news.t-online.com:
    > Have you tried just to echo the elements of $_FILES[]? It should give you
    > the temp path being used.
    >
    OK, I dumped the OpenSA install, and started over with the lastest stable
    build of Apache 1.3 from apache.org, and the lastest version of PHP, and
    now everything works. Something is broken in OpenSA. Sigh.

    Thanks for the help.

    --
    Larry Flynt for Governor
    Bringing dignity back to the Governor's Mansion

    Terry Austin
    [email]taustin@hyperbooks.com[/email]
    Terry Austin Guest

  14. #13

    Default uploading files

    Hi,

    I have made a php script for uploading files to the server. It works fine
    on the pre test:
    if (($uploadDir == "ERROR") OR ($uploadLogDir == "ERROR"))
    {

    return false;
    }
    else
    {
    if (is_uploaded_file($tempFileName))
    {
    but this next test goes false:
    if (move_uploaded_file($tempFileName,$uploadDir . $fileName))
    {

    Someone with a clue on this?

    Sindre

    --
    Sender med M2, Operas revolusjonerende e-postprogram: [url]http://www.opera.com/[/url]
    Sindre Hiåsen Guest

  15. #14

    Default Re: uploading files

    Sindre Hiåsen wrote:
    > but this next test goes false:
    > if (move_uploaded_file($tempFileName,$uploadDir . $fileName))
    > {
    >
    > Someone with a clue on this?
    >
    Check the permissions of the target dir.


    JW



    Janwillem Borleffs Guest

  16. #15

    Default Uploading Files

    Hi

    I am realtively new to CF. I am trying to accomplish something that I am not
    sure i can do with CF. I want to have visitors to a page on our site have the
    ability to upload files to a specific folder on our website. I have no access
    to CF on the server side as it is a service provided by my ISP. I have tried
    CFFILE with no luck. I have successfully done it with CFFTP but i am unable to
    pass the file name via a form. It seems to want to pass the entire path which
    causes errors when the file is uploaded. Does any one have a very simple
    solution to this. If so I wouls very much it. Please email me at
    [email]webmaster@clcintersol.com[/email] or reply here. Many thanks in advance

    I believe my ISP is using CF 5

    CanWesTech Guest

  17. #16

    Default Re: Uploading Files

    I had the same problem along time ago and I know that doesn't help you at
    all... err sorry... Try <cfoutput>#Server.ColdFusion.ProductName# and
    #Server.ColdFusion.ProductVersion#</cfoutput> to find out what you ISP is
    running

    Knum Guest

  18. #17

    Default Re: Uploading Files

    your ISP may have disabled that tag, ck with them to verify
    gwgiswebmaster Guest

  19. #18

    Default Re: Uploading Files

    This is the code I use: (This is taken straight form a web site, so you will
    need to work through the code) I will also update fields in the database. Good
    luck 1st - the form page: <table width='100%' border='0' cellpadding='5'
    cellspacing='0' class='textPlain12'> <form action='HR_addFormAction.cfm'
    method='post' enctype='multipart/form-data'> <input name='HR_DocID'
    type='hidden' value='<cfoutput>#getDetails.HR_DocumentID#</cfoutput>'>
    <input name='HR_FormAddDate' type='hidden' value='<cfoutput>#DateFormat(Now(),
    'dd mmmm yyyy')#</cfoutput>'> <input name='HR_FormStatus'
    type='hidden' value='Live'> <tr> <td align='left'>Form
    Name : <input name='HR_FormTitle' type='text' size='30'
    maxlength='60'> Form Number: <select
    name='HR_FormNumber' class='textPlain12'> <option value='1'
    selected>1</option> <option value='2'>2</option>
    <option value='3'>3</option> <option value='4'>4</option>
    <option value='5'>5</option> <option
    value='6'>6</option> <option value='7'>7</option>
    <option value='8'>8</option> <option value='9'>9</option>
    <option value='10'>10</option> <option
    value='11'>11</option> <option value='12'>12</option>
    <option value='13'>13</option> <option
    value='14'>14</option> <option value='15'>15</option>
    </select> Form Reference: <input
    name='HR_FormRef' type='text' size='12' maxlength='20'> </td>
    </tr> <tr> <td>Add Document: <input
    name='HR_FormFileName' type='file' size='40'> (See &amp;quot;Hints&amp;quot;)
    </td> </tr> <tr> <td align='center'><input
    type='submit' value='Add Form'> </td> </tr>
    </form> </table> Action page: <!--- Update the general information
    first ---> <!--- Check to see if the details have been passed ---> <cfparam
    name='FORM.HR_DocID' default='0'> <cfparam name='FORM.HR_FormTitle'
    type='string' default=''> <cfparam name='FORM.HR_FormFileName' type='string'
    default=''> <cfparam name='formFolder' default=''> <cfparam name='FieldError'
    default='NONE'> <cfparam name='FileFieldError' default='NONE'> <cfif
    IsDefined('FORM.HR_FormFileName')> <!--- Set up the diffrent image folder and
    verialbles ---> <cfset URL.HR_DocID = FORM.HR_DocID> <cfif IsDefined
    ('FORM.HR_FormTitle')> <cfset FolderName = 'forms'> <!--- Now set
    the Image Folder variable to be used by CFFILE---> <cfset formFolder =
    ExpandPath('#FolderName#')> <cfelse> <cfset FieldError = 'Error: You
    must select a Document.'> <cfabort> </cfif> <cfif FORM.HR_FormFileName EQ
    ''> <cfset FileFieldError = 'Error: You must select a document file to
    upload.'> <cfabort> </cfif> </cfif> <!--- Upload the image ---> <cfif
    isDefined('FORM.HR_FormFileName') AND (FORM.HR_FormFileName NEQ '') AND
    (FieldError EQ 'NONE') AND (FileFieldError EQ 'NONE')> <cftry> <cffile
    action='upload' filefield='HR_FormFileName' destination='#formFolder#'
    nameconflict='makeunique' accept=''> <!--- Make sure the file is't more
    that 80K ---> <cfif CFFILE.FileSize GT 1132250> <cfthrow
    type='SizeError' message='Error: The document cannot be greater than 200
    kilobytes which is the maximum size allowed, please select another one and try
    again.'> </cfif> <!--- Catch the size error ---> <cfcatch
    type='SizeError'> <cfabort showerror='#cfcatch.Message#'>
    </cfcatch> </cftry> <!--- Store the name of the file inside the form
    variable ---> <cfset FORM.HR_FormFileName=file.ServerFile> <!--- Insert all the
    data to the database ---> <cfinsert datasource='#REQUEST.DataSource#'
    tablename='tblHRFroms'> </cfif> <!--- Send the user back --->
    <cflocation url='HR_addForm_1.cfm'>

    CoffeeCup Guest

  20. #19

    Default Uploading Files

    Hi can anyone help? I have a database on our website that holds all of the
    products that we sell. I have created some asp pages that lets an admin user
    edit all of the products on the database. However alot of the products have
    ..pdf datasheets that would need to be viewed when clicking on an apropriate
    link. The question is how can i have it so that the admin user that is editing
    the products can upload .pdf to an apropriate directory and the correct path
    will be added to the web database so that the pdf can be viewed. Thanks John

    pepps Guest

  21. #20

    Default Re: Uploading Files

    you can use a component like ASPUpload or take a look at Pure ASP File
    Upload

    pepps wrote:
    > Hi can anyone help? I have a database on our website that holds all of the
    > products that we sell. I have created some asp pages that lets an admin user
    > edit all of the products on the database. However alot of the products have
    > .pdf datasheets that would need to be viewed when clicking on an apropriate
    > link. The question is how can i have it so that the admin user that is editing
    > the products can upload .pdf to an apropriate directory and the correct path
    > will be added to the web database so that the pdf can be viewed. Thanks John
    >
    Manuel Socarras Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139