Uploading files and knowing when an upload is complete

I have created a file system that allows for users to upload files into media fields on the database. It works fine on the local PC. However, over a remote connection the file is not getting uploaded, or is being corrupted. Can anybody see where it’s going wrong. The code is below.

Do I need some form of progress bar to show the file being uploaded, and confirm the upload before moving on in the script?

If so, can somebody advise on how I do this?

Many thanks in advance.

MerMer

controller.newRecord(true)//new record at top of list
//get the full path to file that needs to be uploaded
var windowsFilePath = application.showFileOpenDialog();
application.output(windowsFilePath);

if (windowsFilePath)//for cancel
{
var normalizedFilePath = “”;
//turns file path into UNIX variant rather than windows.
normalizedFilePath = utils.stringReplace(windowsFilePath,‘\’,‘/’)//make windows path like unix path
application.output(normalizedFilePath);
// saves file into attachment media field.
attachment = application.readFile(normalizedFilePath);
// gets the file size and saves this into the filesize field.
filesize = plugins.file.getFileSize(normalizedFilePath);
var idx = normalizedFilePath.lastIndexOf(“/”);
application.output (idx);
if (idx != -1)
{
normalizedFileName = normalizedFilePath.substring(idx+1);
application.output (normalizedFileName);
}
filename = normalizedFileName;

}
// puts the USER NAME in the source field
source = security.getUserName();

//show input dialog ,returns nothing when canceled
var typedInput = plugins.dialogs.showInputDialog(‘Description’,‘Enter a description of the file’);
filedescription = typedInput

controller.saveData()

//remind the user to enter a company name.
//show dialog
var thePressedButton = plugins.dialogs.showInfoDialog(‘Company?’, ‘Enter any associated company from the company field’,‘OK’);
application.output (thePressedButton);

//sets cursor into the company field
elements.companyid.requestFocus(true);

what do you mean by: remote connection?
Does it work in a client, on the same computer? (localhost)
are a doesn’t it work on a client outside the company?

Should’nt be any different!

About the progressbar. You can’t show a progressbar, because you don;'t have control over the size that is uploaded.

You have to wait, till the file is uploaded. A while ago I requested somekind of progress, so we can see, how far the file uploaded. Don;t know if it is on the feature-list

The plugin of Salerno, does have asynchroon uploade\ with a progressbar, but that one is’tn free.

Thanks for the input. It turns out that the code is correct and I got it working when I flushed the solution. Without the flush it must have been picking up the old code which pointed to the wrong media field.

MerMer