Local file UPLOAD with RB Personal

new BookmarkLockedFalling
Jerry Muelver
Administrator
*****

Jerry Muelver Avatar

Posts: 521

Post by Jerry Muelver on Oct 4, 2007 4:16:26 GMT -5

On the web, the UPLOAD command creates a virtual file on the server from a file on the user's computer. With RBP, the UPLOAD command just gets the filename, and doesn't make a copy of the file. So if you UPLOAD then try to OPEN the file, RB takes just the filename -- no pathname -- and attempts to open that file in the default directory, rather than using the pathname it was given. So if I UPLOAD
upload "Choose a file to upload:"; fname$
open fname$ for input as #rawdata

and browse to
c:\rbp\hytextviewer_project\pagedemo02.txt
then try to open it, I get:
File uploaded: pagedemo02.txt

Runtime Error: open fname$ for input as #rawdata
File not found: c:\rbp\pagedemo02.txt

Just grabbing the filename, no pathname, from the UPLOAD file browser is fine for the web, but awkward running RB Personal off the web. To get around the problem, place the target upload file in the RB server's root directory, c:\rbp\myfile.txt, to get your program running. Problem is, there's a lot of other files in that directory, and navigating/editing can be a pain. It would be nice to use the project directory for project-related file, so it might be better to use a temporary string manipulation to hang the directory pathname onto the fname$ filename variable. Just remember to remove the manipulation before releasing the program!
carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975