Applescript Studio Drag and Drop "do shell script" program

I am trying to write an Applescript Studio program that can make it much easier for me to upload files (via FTP) to my personal webspace. I want to be able to drag files onto my application, and have a window come up asking me what I would like to name the uploaded file (in a text box). However, when I drag a file onto my app, I get the error that “posix_file” is not defined. Any help would be greatly appreciated!

on open upload_file
	set posix_file to POSIX path of upload_file
end open

on clicked theObject
	if the name of theObject is equal to "upload_button" then
		set upload_dir to contents of text field "directory_box" of window "main_window"
		do shell script "curl -T " & posix_file & " ftp://<username>:<password>@upload.comcast.net/" & upload_dir
	else if the name of theObject is equal to "cancel_button" then
		quit
	end if
end clicked

posix_file is defined in a different handler than where it’s used so you’ll have to declare it as

global posix_file

external to the handlers. Hope that helps…

This sounds fun and interesting, do you still have this Xcode project? I’ve been tinkering with Applescript for years but have never tried AppleScript Studio, it would be instructive to see your project files.