Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 5 of 5

Thread: FTP love

  1. #1
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014

    FTP love

    Hello everyone…
    Looking to make an FTP up loader for my photographers to upload video to my site.
    www.newsmediaservices.com

    I’ll have four buttons, Picture.jpg, Movie.flv, Movie.zip and Upload files.. The script in the Picture.jpg button reads like this:

    jpg_result = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", ".jpg", false, false);
    Paragraph.SetText("jpg Paragraph", jpg_result[1]);

    The return I get looks like this:
    C:\Documents and Settings\Administrator\Desktop\G68morisita0009.jpg

    What I need to show is simply G68morisita0009.jpg I know this has something to do with string trimming.

    The upload button holds the following script:
    Paragraph.SetText("info Paragraph", "Connecting to server...");
    Connected = HTTP.TestConnection("www.google.com", 8, 80, nil, nil);
    if Connected then
    Paragraph.SetText("info Paragraph", "Connecting to server...");
    FTP.Connect("www.mysite.com", "login", "password", "", true);

    --Check to see if it's ok to gain access
    FTP.ChangeDir("websites/newsmediaservices.com/docs/ok");
    yes_result = FTP.GetFileInfo("peter_davidson.txt");
    if yes_result == nil then
    result = Dialog.Message("Notice", "You're no longer allowed to use this service. If you think this is an error, go to www.newsmediaservices.com for contact information.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Application.Exit(0);
    end

    FTP.Download("peter_davidson.txt", _TempFolder .. "\\peter_davidson.txt", nil);
    --reads it into memory
    yesno_result = TextFile.ReadToString(_TempFolder .. "\\peter_davidson.txt");
    --then turns that into a #
    aresult = String.ToNumber(yesno_result);
    --deletes the text file
    File.Delete(_TempFolder .. "\\peter_davidson.txt", false, false, false, nil);
    if aresult == 1 then
    --yes it passed

    --first the .jpg
    Paragraph.SetText("info Paragraph", "Changing directory...");
    FTP.ChangeDir("websites/newsmediaservices.com/docs/ftp");
    Paragraph.SetText("info Paragraph", "Uploading .jpg...");
    FTP.Upload(jpg_result, jpg_result, nil);

    HAVING AN ISSUE HERE IN RED

    See any other messups let me know, thx
    Last edited by Bruce; 02-10-2009 at 03:06 PM.

  2. #2
    Join Date
    Apr 2005
    Location
    Allentown, PA.
    Posts
    52
    Running out to dinner, so don't have time to look through your code:

    I've had problems with FTP uploading from a temp folder before, had to do it through AutoPlay\\Docs\\
    Also: I've never used an underscore "_" in a name, dunno if that would give you a problem? jpg_result (to) jpgresult

    Here is the basic code I use when ftp uploading...
    hostname = "";
    account = "";
    password = "";
    username = "";

    FTP.Connect(hostname, username, password, account, true);
    FTP.ChangeDir(sFolder);
    FTP.Upload("AutoPlay\\Docs\\filename.zip", nil);
    FTP.Disconnect();

    ----------------------
    Dunno if any of that helps, I'm still a newbie here

  3. #3
    Join Date
    Aug 2003
    Posts
    2,427
    Dialog.FileBrowse returns a table. You need to use String.SplitPath to get the filename and file extension. The help file gives some good examples.

  4. #4
    Join Date
    Nov 2006
    Posts
    233
    the problem is the very last lines, replace you last line

    Code:
    FTP.Upload(jpg_result, jpg_result, nil);
    with the following 2 lines

    Code:
    tblSplit = String.SplitPath(jpg_result[1]);
    FTP.Upload(jpg_result[1], tblSplit.Filename .. tblSplit.Extension, nil);

  5. #5
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Got it! Thx guys

Similar Threads

  1. Secure FTP Action Plugin
    By Ulrich in forum AutoPlay Media Studio 7.5 Plugins
    Replies: 22
    Last Post: 09-01-2011, 08:20 PM
  2. Custom FTP Image Up Loader
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 6
    Last Post: 05-14-2009, 08:37 AM
  3. Secure FTP
    By TJ_Tigger in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 08-19-2008, 04:46 PM
  4. Updated FTP It!, photo uploader.
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 4
    Last Post: 11-08-2006, 09:12 PM
  5. Spotlight: FTP File Transfer Plugin
    By Desmond in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 03-10-2004, 09:34 PM

Posting Permissions

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