Can i delete ALL files in directory ?

i create a upload test using FileReference & PHP.
In this scenario user upload files to http server.
Now how can i delete all files in /files/uploads folder in AS3
AS3 Code:
req = new URLRequest();
req.url = ( stage.loaderInfo.parameters.f )? stage.loaderInfo.parameters.f : "http://www.website.com/test/upload.php";
uploadFile = new FileReference();
select_btn.addEventListener( MouseEvent.CLICK, browse );
uploadFile.addEventListener( Event.COMPLETE, complete_func );
uploadFile.addEventListener( DataEvent.UPLOAD_COMPLETE_DATA, show_message );
function browse( e:MouseEvent )
          filefilters = [new FileFilter('Images',"*.jpg;*.png;*.gif")];
          uploadFile.browse( filefilters );
function complete_func( e:Event )
          trace( 'complete !' );
function show_message(e:DataEvent)
if (e.data == 'ok')
          label_txt.text = 'The file has been uploaded.';
else if ( e.data == 'error')
          label_txt.text = 'The file could not be uploaded.';
PHP Code:
<?php
$uploads_dir = './files/uploads';
if( $_FILES['Filedata']['error'] == 0 ){
          if( move_uploaded_file( $_FILES['Filedata']['tmp_name'], $uploads_dir.$_FILES['Filedata']['name'] ) ){
                    echo 'ok';
                    exit();
echo 'error';
exit();
?>

You need call another PHP file
<?php
   $directory = './files/uploads';
   getDirectoryList ($directory);  
   //This function find all the files in the directory
   function getDirectoryList ($directory)
     // create an array to hold directory list
     $results = array();
     // create a handler for the directory
     $handler = opendir($directory);
     // open directory and walk through the filenames
     while ($file = readdir($handler)) {
       // if file isn't this directory or its parent, add it to the results
       if ($file != "." && $file != "..") {
    //$results[] = $file;
     // Delete Files
    $filename = $file;
  unlink($filename); //this delete a file
     // tidy up: close the handler
     closedir($handler);
?>

Similar Messages

  • Time capsule intern.1TB hard drive.How can I delete all files

    Hello How can I delete all files from my timecapsule.
    I have connectet it with Wifi or ethernet. It is not possible.
    I have made a reset.
    I have tried it often.
    Please help
    Greetings from Vienna
    Pepimeier

    If you open Macintosh HD > Applications > Utiltiies > AirPort Utility and click Manual Setup, are you able to access the settings for the Time Capsule?
    Or, does AirPort Utility scan for the Time Capsule and then not find it?

  • Can I delete all files and users (including admin account) without re-installing SL?

    I have a 1st generation Macbook Air, running Snow Leopard 10.6.8.  Just bought myself a new MBA, want to sell the old one (privately, not soliciting here).
    The original install disks were Leopard.  I bought a family pack SL and upgraded the MBA at that point.  Earlier this year I sold my old Mac Mini (when I upgraded) and included the SL install disks with that sale (stupid of me).
    Now I want to sell the old MBA.  Ideally, I'd have a clean install on SL on it, minus all previous files and accounts.  I've done that before when selling old computers, reformatted / erased the HD, then reinstalled the OS.  But I don't have the SL disk anymore, and I don't really want to pay for it just to prep this notebook for sale.
    AFAICT, my options are:
    wipe the HD and reinstall Leopard (the only OSX disks I have).  Whoever buys it from me would need to upgrade to SL themselves, and from there to Lion if they want.
    somehow try to delete all files and users without touching the current install of SL.  I'm not terribly worried about security of what little information is on the MBA (nothing important to me), so I don't mind trashing files and then emptying trash instead of wiping the HD block by block. 
    Any ideas for how to do #2?  I can trash all files/folders under /user, uninstall all applications and delete their folders from Library, uninstall all browsers except Safari and wipe the history from that...
    Is there other stuff I should be deleting?  plist files, maybe?  I'm leery of messing around too much and disrupting the install of the underlying OS.
    Can I also delete the admin account (or rename it "admin" with a generic default password?)?
    Any other suggestions?  Thanks.

    Trashing files you have created is relatively easy. Getting rid of an account is a bit harder. Trashing the .plist files, etc., that may contain personal info is a lot harder, and there is always the risk that you will miss something.
    Best, and easiest, and customary, is to do option #1 - wipe the drive and re-install the original OS from the original disk set. The receiver of the machine can then decide which OS they want to upgrade it to, and purchse accordingly.
    The original disk set for that machine should be included with it when it is sold.

  • How can I delete all files not authorized for this computer?

    Hi there,
    first off, I promise right here and now, that I will never buy a DRMed song or video again...
    And here is my probelm: I'm using my Mac and iTunes for ages and all things were perfectly fine. I used to have a girlfriend and both of us had our iTunes accounts and were buying stuff everyday.
    After some time we split-up and I kept the computer with the files and the authorization - no worries.
    But then my LogicBoard died. Now apart from the fact that all over sudden half of my music that I used to listen to for years doesn't work any longer I also have a lot of explaining with my new GF to do.
    Ok, guys, please help me out: How on earth do I find ALL the songs that were bought with that specific account and just delete them? (So what, if half the music is gone, but I have to act one fast!).
    thanks for your help!

    Just to let everyone know that there seems to be NO solution for this problem. I contacted the iTunes Support and they told me to go through the library one by one and delte all the songs manually.
    Well, what can I say? I wasted many hours of my life, I went through thousands of songs and delted hundreds of them manually. I'm very frustrated with Apple that they don't provide a function to solve issues like that more elegantly and I'm even more upset with the content industry. I still feel that the music industry is not interested in people enjoying their legally bought products and hope that the current economic downturn wipes out the music industry as we know it.
    I like music, I like to support musicians (not the studio bosses) but I hate the fact that when we purchased DRMed music in times where everyone was using P2P and alternatives like iTunes Plus and Amazon MP3s I, as an honest customer, am now much worse off than if I had pirated the music.
    My advice to all: Hands-off DRMed songs and movies! You will end up in trouble even if it seems to be all easy now and it is just not worth the pain!

  • I previously had PS CS5 Trial installed but removed it using both Control Panel Programs and deleting all files from the CS5 directory on Program Files.  I then installed a purchased product from Adobe disc using the serial number on the case.  But when I

    I previously had PS CS5 Trial installed but removed it using both Control Panel Programs and deleting all files from the CS5 directory on Program Files.  I then installed a purchased product from Adobe disc using the serial number on the case.  But when I try to launch it, I get a screen headed Photoshop CS5 Extended Trial.  It asks for the serial number and says that my trial has expired.  It rejects the serial number from the Adobe case saying "This Serial Number is not valid for this product".  It thinks that I still have the expired Trial Version installed.  How do I convince it (the program) that the Trial Version is long gone and the currently installed product was installed with a valid and accepted serial number????

    Let me know how it goes. Go into your Adobe account and register your serial number asap.
    https://www.adobe.com/account/my-products-services.html
    That way, should you lose it or you need support, it is on record that it's yours and you can fetch your s/n it from anywhere.
    There are too may sad stories here, where people forgot and the box is buried or lost.
    Gene

  • Deleting all files in a directory

    Hi,
    Is it possible to use cffile to delete all files in a
    directory. I have a function that creates a file in seperate parts
    and places the finished file into a folder. But I need a check to
    delete all files currently existing in said folder. I understand it
    is possible to query a folder for existing files and then use that
    query with cffile to delete the files... I just don't know how to
    do it.
    Thanks for your help

    I am not postivie, but I think I recall learning that the
    delete all function is prohibited via CF. You can delete specific
    files, though.
    If this is, in fact, the case, you could query the directory,
    and then loop through the resultant query, deleting each file one
    at a time.

  • How to delete all file in a directory

    Hi,
    Myself is Lokesh....can anyone tell me how can we delete all existing mail file which i kept in linux (PATH IS: /usr/share/mailfile/)...the mail file extension is *.MAIL. Please help me in sortout this problem...

    See listFiles (FileFilter) and delete ().

  • How can I delete all the files in the Adobe CS4 Master Collection from my machine?

    How can I delete all the files in the Adobe CS4 Master Collection from my machine. I have tried Control Panel but it will not do anything, there are no error messages, it is like as if it is ignoring my instruction. Why should it be so difficult to delete programs one does not want. Any ideas please.

    Moved from Cloud forum to Downloading, Installing forum
    Try running the Adobe Cleaner Tool
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

  • HT201250 Once I use time machine to back up my Mac Air, can I delete all my files from HD and still have access to them on TM (external hard disk)?

    New to Time Machine. The HD on my Mac Air is full so I got an external HD and using TM to back up everything.
    Can I erase all files (pictures, docs, etc) from my Mac and still have access to those files through Time Machine?

    That is a bad idea. Time Machine is strictly a backup utility. What you describe will require archiving files, which Time Machine is not designed to accomplish.
    Once you erase files from your MacBook Air, they will eventually be erased from your Time Machine backup. This is by design, as Time Machine will eventually fill your backup volume and will delete old files as required. Depending on when they were first backed up and how long they existed on your MBA before you erase them, they could disappear in as little as one hour.
    Use Carbon Copy Cloner or equivalent "clone" utility and configure it to archive files that do not exist on the source, or simply copy them over manually using the Finder. You can then delete them from your MBA. Bear in mind that once you do that, you no longer have a backup copy. The only copies will exist on the external HD.

  • How can I delete a file? At the moment I delete each pic and it takes ages! I tried select all and managed to delete all my 2300 photos!!  I've got them back but I've also got back 980 which I had already deleted 1 by 1 over the past 6 months!  Help!

    Please help! How can I delete a file without deleting all my photos?  I have just managed to delete all my more than 2000 photographs by choosing' Select all' and then delete. But I thought only 'all' the photographs in the file I had open would be selected! I have got them back, but I've also got back more than 800 others that I'd deleted SINGLY over the last 6 months! HELP!

    Put a Photo in the iPhoto Trash.
    iPhoto Menu -> Empty Trash
    This removes the photo from iPhoto and the Hard Disk (in every version of iPhoto except iPhoto11)
    In iPhoto 11 the file goes to the System Trash, you need to empty that too.
    Regards
    TD

  • All my files in my macbook pro is saved several times. How can I delete all the multiple copies easily?

    All my files in my macbook pro is saved several times. How can I delete all the multiple copies easily?

    Moved from Cloud forum to Downloading, Installing forum
    Try running the Adobe Cleaner Tool
    http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

  • HT201250 I only want to keep the latest backup version of my files.  Can I delete all the earlier backups & if so, how?

    I only want to keep the latestTime Machine backup version of my files.  Can I delete all the earlier backups to save my external drive space, & if so, how?

    Jamarac wrote:
    I only want to keep the latestTime Machine backup version of my files.  Can I delete all the earlier backups to save my external drive space, & if so, how?
    Doesn't sound like much of a backup plan, but why not just wipe your backup drive and make a fresh backup of your current system? Be easier and safer,
    Cheers
    Pete

  • How can I delete ALL contacts on my iphone and replace with an updated file from my Outlook on PC

    how can I delete ALL contacts on my iphone and replace with an updated file from my Outlook on my PC

    iTunes running, your phone connected, on the Info Pane, scroll down to "Advanced". Put a check in the box labeled "Replace Info on this Phone for Contacts" on next sync. Hit the apply/sync button.

  • How can I delete all components of Firefox 8 for Mac. Again...all components and hidden files. (YES, I did check the Moz web site but the page was essentially blank

    I have an unstable install of Mozilla firefox 8 and need to delete ALL files from my mac running OSX 10.7.2. I went to Mozilla web site and got this but it does not populate with content:
    http://support.mozilla.com/en-US/kb/Uninstalling%20Firefox?s=uninstall+firefox+mac&r=0&as=s#w_removing-user-data-and-settings
    But nothing appears at this URL.

    Please note I need all files removed including the hidden ones.
    thx

  • Udump directory ...can I delete the files?...PLz help me

    hi guys,
    I have disk space problem on my database server , 98% of my partition disk is used...checking the files I see that in my udump diectory there is a new 3GB trace file created by Oracle ...my questiions are :
    1 - can i delete this file?
    2- how can i know if oracle is still using it?
    my os system is Linux and I' working on Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    thanks a lot,

    thank you... so these files are not necessary for Oracle?
    below some lines from the big udump file
    /u01/app/oracle/admin/aed01/udump/aed01_ora_11397.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/oracle/product/10.2.0/aed01
    System name: Linux
    Node name: aed01.es6.foree.lan
    Release: 2.6.18-53.1.14.el5xen
    Version: #1 SMP Tue Feb 19 07:33:17 EST 2008
    Machine: x86_64
    Instance name: aed01
    Redo thread mounted by this instance: 1
    Oracle process number: 27
    Unix process pid: 11397, image: [email protected] (TNS V1-V3)
    *** 2009-11-13 00:05:54.880
    *** ACTION NAME:() 2009-11-13 00:05:54.490
    *** MODULE NAME:(SQL*Plus) 2009-11-13 00:05:54.490
    *** SERVICE NAME:(SYS$USERS) 2009-11-13 00:05:54.490
    *** SESSION ID:(913.14607) 2009-11-13 00:05:54.478
    *********START PLSQL RUNTIME DUMP************
    ***Got internal error Exception caught in pfrrun() while running PLSQL***
    ***Got ORA-4030 while running PLSQL***
    FUNCTION FREE_CLIENT.DB_FUNC_SEARCH_PARENT:
    library unit=b9776680 line=1 opcode=84 static link=2aabac7768e8 scope=0
    FP=2aabac776b88 PC=cea6769a Page=0 AP=2aabac776b88 ST=2aabac776cd8
    DL0=2aaaacccd6a0 GF=2aaaacccd708 DL1=2aaaacccd6c8 DPF=2aaaacccd6f8 DS=cea67740
    DON library unit variable list instantiation
    0 b9776680 2aaaacccd708 2aaaaca4b3b8
    1
    2
    3
    4
    scope frame
    2 0
    1 2aabac776b88
    package variable address size
    0 2aaaacccd710 328
    version=43123476 instantiation size=432
    exception id error DON offset begin end DID
    0 1403 0 0 72 20 71
    1 0 0 1 114 14 109
    aed01_ora_11397.trc
    Edited by: OracleJavaLinux on Nov 13, 2009 2:18 AM

Maybe you are looking for

  • How do I change font and colors back to default?

    I have changed the font and color of the text through the tools button and the options button and the content tab. I find nothing telling me how to change the font and colors back to default font and colors. Can you advise me? I'm using Windows 7 Hom

  • Payment Advice transaction F110.

    Hi All, I have copied and modified the form F110_IN_AVIS. From transaction F-43 I am creating a document and from transaction F110 running payment advice.The form is working fine in development but in quality it is not picking data from REGUH table.T

  • Java crashes on a solaris 9 randomly with a core dump

    Hello Currently we are using JBoss Application server on solaris 9. Over a period of time. Java crashes suddenly. The condition under which this can be reproduced is currently not reproduceable. But over a period of time, this crash just happens. The

  • Help sending out long email message from ORACLE PL/SQL

    Hello, I need help sending out long email message from ORACLE PL/SQL. My message(email body) contains about 4000 characters and comes out truncated somewhere on the middle. My business requirements do not allow me to send it as attachment. I am using

  • Notification Sounds Being Delayed

    Since I've installed Mountain Lion I've been having a problem with my notification sounds not coming through.  For some unknown reason my notification sounds will stop working.  Like reminders and emails.  Even the sound when an emal is being sent fr