Alpha Video Training
Results 1 to 3 of 3

Thread: uploading files

  1. #1
    Guest
    Real Name
    John Mays
    Join Date
    Apr 2004
    Posts
    199

    Default uploading files

    I have created a upload file page as per alpha's example

    I require that I am able to upload up to 30 photos at a time and changed the code, which works when all 30 photos are added, but when only adding say 10 photos I get an error :

    500 Internal Server Error
    Script Error
    Error:Script: /fileupload2.a5w line:10
    file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload2
    The system cannot find the path specified.
    c:\kmassessors\Photos Temp\uploaded photos\

    here is my code:

    HTML Code:
    <html> 
    
    <%a5 
    
    dim msg as c = "" 
    
    if eval_valid("cmd") 
    
        file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload.filename, FileToUpload.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload2.filename, FileToUpload2.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload3.filename, FileToUpload3.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload4.filename, FileToUpload4.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload5.filename, FileToUpload5.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload6.filename, FileToUpload6.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload7.filename, FileToUpload7.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload8.filename, FileToUpload8.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload9.filename, FileToUpload9.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload10.filename, FileToUpload10.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload11.filename, FileToUpload11.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload12.filename, FileToUpload12.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload13.filename, FileToUpload13.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload14.filename, FileToUpload14.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload15.filename, FileToUpload15.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload16.filename, FileToUpload16.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload17.filename, FileToUpload17.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload18.filename, FileToUpload18.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload19.filename, FileToUpload19.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload20.filename, FileToUpload20.data)
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload21.filename, FileToUpload21.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload22.filename, FileToUpload22.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload23.filename, FileToUpload23.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload24.filename, FileToUpload24.data)
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload25.filename, FileToUpload25.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload26.filename, FileToUpload26.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload27.filename, FileToUpload27.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload28.filename, FileToUpload28.data)
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload29.filename, FileToUpload29.data) 
    	file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload30.filename, FileToUpload30.data) 
    	    
    
        msg = "<a href=\"/" "\" target=\"_blank\">" "</a> Your Files Were Uploaded<br /><br />" 
        
    end if 
    
    %> 
    
     
    
    <head>
    
    <title>File Upload example</title>
    
    </head> 
    
    <body bgcolor="#ffffff"> 
    
    <%a5 ? msg %> 
    
    <form action="<%a5 ? request.script_name %>" method="post" enctype="multipart/form-data">
    
    <p><strong>Photo 01 </strong>
    <input type="file" name="FileToUpload" >&nbsp;<strong>Photo 02
    
    <input type="file" name="FileToUpload2" >&nbsp;</strong>
    </p><p>
    <strong>Photo 03 </strong>
    
    <input type="file" name="FileToUpload3" >&nbsp;<strong>Photo 04 </strong>
    
    <input type="file" name="FileToUpload4" >
    </p><p>
    <strong>Photo 05</strong>
    
    <input type="file" name="FileToUpload5" >&nbsp;<strong>Photo 06</strong> 
    
    <input type="file" name="FileToUpload6" >
    <p></p>
    <strong>Photo 07</strong>
    
    <input type="file" name="FileToUpload7" >&nbsp;<strong>Photo 08</strong> 
    
    <input type="file" name="FileToUpload8" > 
    <p></p>
    <p><strong>Photo 09</strong>
    
    <input type="file" name="FileToUpload9" >&nbsp;<strong>Photo 10</strong> 
    
    <input type="file" name="FileToUpload10" > 
    </p>
    <p><strong>Photo 11</strong>
    
    <input type="file" name="FileToUpload11" >&nbsp;<strong>Photo 12</strong> 
    
    <input type="file" name="FileToUpload12" > 
    </p>
    <p><strong>Photo 13</strong>
    
    <input type="file" name="FileToUpload13" >&nbsp;<strong>Photo 14</strong> 
    
    <input type="file" name="FileToUpload14" > 
    </p>
    <p><strong>Photo 15</strong>
    
    <input type="file" name="FileToUpload15" >&nbsp;<strong>Photo 16</strong> 
    
    <input type="file" name="FileToUpload16" > 
    </p>
    <p><strong>Photo 17</strong>
    
    <input type="file" name="FileToUpload17" >&nbsp;<strong>Photo 18</strong> 
    
    <input type="file" name="FileToUpload18" > 
    </p>
    <p><strong>Photo 19</strong>
    
    <input type="file" name="FileToUpload19" >&nbsp;<strong>Photo 20</strong> 
    
    <input type="file" name="FileToUpload20" > 
    </p>
    <p><strong>Photo 21</strong>
    
    <input type="file" name="FileToUpload21" >&nbsp;<strong>Photo 22</strong> 
    
    <input type="file" name="FileToUpload22" > 
    </p>
    <p><strong>Photo 23</strong>
    
    <input type="file" name="FileToUpload23" >&nbsp;<strong>Photo 24</strong> 
    
    <input type="file" name="FileToUpload24" > 
    </p>
    <p><strong>Photo 25</strong>
    
    <input type="file" name="FileToUpload25" >&nbsp;<strong>Photo 26</strong> 
    
    <input type="file" name="FileToUpload26" > 
    </p>
    <p><strong>Photo 27</strong>
    
    <input type="file" name="FileToUpload27" >&nbsp;<strong>Photo 28</strong> 
    
    <input type="file" name="FileToUpload28" > 
    </p>
    <p><strong>Photo 29</strong>
    
    <input type="file" name="FileToUpload29" >&nbsp;<strong>Photo 30</strong> 
    
    <input type="file" name="FileToUpload30" ><br >
    
    <input type="submit" name="cmd" value="Upload Photos"> 
    </p> 
    
    </form> 
    
    </body> 
    
    </html>
    Any help reagarding this would be apprecaited

    Thank-you

    John

  2. #2
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,834

    Default Re: uploading files

    You need to test the field for a value and only proceed if a value exists. Here is what I use in the same situation:

    if FileToUpload.filename<>""
    file.from_blob("c:\kmassessors\Photos Temp\uploaded photos""\\" + FileToUpload.filename, FileToUpload.data)
    end if

    etc.

    You need this also becuse you have no control over if they skip line, using field 1, 5, 7 ,8 as an example.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  3. #3
    Guest
    Real Name
    John Mays
    Join Date
    Apr 2004
    Posts
    199

    Default Re: uploading files

    Hi Steve

    Thanks for that, will give it a try

    John

Similar Threads

  1. Uploading files to the WAS, jpg or pdf only?
    By David Priest in forum Web Application Server v7
    Replies: 0
    Last Post: 07-31-2006, 07:40 AM
  2. Uploading large files
    By Michael Crume in forum Web Application Server v7
    Replies: 2
    Last Post: 06-27-2006, 12:46 PM
  3. Uploading files
    By John Costello in forum Alpha Five Version 5
    Replies: 10
    Last Post: 06-21-2005, 05:45 AM

Bookmarks

Posting Permissions

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