
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
Upload directory problem
I'm a real newbie to flash. I'm using this actionscript and php code from a tutorial to build an upload movie. The problem I'm having is that the upload movie calls index.php of the directory it's in to do the server side stuff (php code below).
What I want to do is define where the upload movie calls to do the server side php. I have a page called uploadmp3.php, for example, where the movie resides. If the movie called on that page for the server side stuff I could define the upload directory based on the username's session variable. __________________________________ ------------------------ ActionScript ------------------------ err.text = "Select an MP3 File. (max filesize 6MB)"; fileUpload = new Object (); fileUpload.onSelect = function (f) { if (f.type == ".mp3" || f.type == ".MP3") { if (f.size < 6291456) { err.text = ""; file.text = f.name; upload.enabled = true; } else { upload.enabled = false; file.text = ''; err.text = "File is too large. Max file size is 6MB."; } } else { upload.enabled = false; file.text = ''; err.text = "Select an MP3 File."; } }; /** * Gets called when the user cancels / closes BrowseForFile Dialog **/ fileUpload.onCancel = function () { upload.enabled = false; err.text = "No file selected."; }; /** * Gets called when the .upload() function is called on a file **/ fileUpload.onOpen = function (fileRef, err, response) { }; fileUpload.onProgress = function (file, bytesLoaded:Number, bytesTotal:Number) { var percent = Math.round (bytesLoaded / bytesTotal * 100); progressBar.setProgress(percent, 100); }; fileUpload.onComplete = function (file, bytesLoaded:Number, bytesTotal:Number) { err.text = "Upload Complete"; }; fileUpload.onHTTPError = function (file, errorCode:Number) { }; /** * If upload is called on a non http url like file:// * but only if you don't read the boolean result from upload() for some reason. * makes some sense actually, var result = file.upload("file://"); returns false; * but file.upload("file://"); throws callback error onIOError. **/ fileUpload.onIOError = function (file) { }; // // More than one file to upload // fileRef = new flash.net.FileReferenceList (); fileRef = new flash.net.FileReference (); fileRef.addListener (fileUpload); onBrowse = function () { // ask the user to choose a file to upload fileRef.browse (); }; browse.addEventListener ('click', onBrowse); onUpload = function () { fileRef.upload ("?"); }; upload.enabled = false; upload.addEventListener('click',onUpload); ______________________________________ --------------------------- It also has the following php component: --------------------------- <?php foreach ($_FILES as $fieldName => $file) { echo move_uploaded_file($file['tmp_name'], "uploads/" .$folder . $file['name']); } ?> --------------------------- Last edited by luiddog : 04-27-2007 at 10:24 PM Reason: grammer |
|
#2
|
|||
|
|||
|
I edited the previous post.
Last edited by luiddog : 04-27-2007 at 09:40 PM |
|
#3
|
|||
|
|||
|
I'm still having a hard time. But I've found out that my 'Restrict Access To Page' code is stopping the upload movie from using the server side php move_uploaded_file from working. Any ideas.
What I'm trying to do is have a flash mp3 uploader on a page resrticted to users and have the uploaded mp3s go into the user's folder. |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using FileReference & FileReferenceList to get a directory - problem | JamieUK | ActionScript 3.0 |
4 | 10-22-2009 06:14 AM |
| Flash Upload Bar- about sessions | wuff | Flash 8 |
0 | 04-23-2006 11:08 AM |
| Image Upload Problem - Please Help! | sukimaster | Flash MX ActionScript |
2 | 03-08-2003 11:08 PM |
| Upload Swf Problem | chup | General Flash | 3 | 11-08-2001 02:33 AM |
| Site Upload Problem | TimF | Site Check | 4 | 11-16-2000 11:50 AM |



