Solved

Preview Uploaded Picture in Flash 8 Before going to Server

Posted on 2006-06-14
15
174 Views
Last Modified: 2010-04-03
I need Help Fast. i have my website to the point where people can come and upload images to my server, but i want them to see a preview of the image and if they dont want that image. it will not save to my server. if they except the image. then it will goto my server. Please help me ASAP. My website is almost complete.

500 points with a Grade A
0
Comment
Question by:leronj23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16905394
Hi
Here is a source file with something like you want but it is uploading the image then breview it . i suggest that if the user didn't like the preview you can delete it from the server ..

http://www.flash-db.com/Tutorials/upload/

Regards,
Ramy
0
 

Author Comment

by:leronj23
ID: 16905464
I seen that tutorial. theres no way to avoid downloading the image to me server?  Im trying to avoid that. If i have 10,000 users come to my site and 2000 image are bad images because they downloaded the wrong one. then i have to delete 2000 images.
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16905714
well, you can delete the image if the user click on "delete image" button (using php) , I don't think it would be a problem with PHP. of course you won't delete those images yourself manually, let the php do it for you

Regards,
Ramy
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:leronj23
ID: 16905773
well i have the image path store in sql and the actual image i have stored into my yahoo server. Can php actually delete the image from my yahoo sever? I know i can delete the path in sql using php.
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16905797
you mean yahoo server as you are hosting the site at yahoo (paid server "Yahoo! Small Business") or free service like geocities ??
0
 

Author Comment

by:leronj23
ID: 16905836
i pay for yahoo! small business and there're hosting my site. Is there a way to store the image in sql to make life easier?
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16905908
in that case, you can delete the file using php easily using php

unlink('D001_image.jpg');

or
$dir = "/path/to/images";
$file = "myImage.jpg";
 unlink($dir . "/" . $file);

Here is a link of a complete explanation about unlink function

http://www.php.net/manual/en/function.unlink.php

Regards,
Ramy
0
 

Author Comment

by:leronj23
ID: 16906156
can i use:

unlink($dir);

To delete the entire folder from my server also?
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16906311
Hi

To delete all files of a particular extension, or infact, delete all with wildcard, a much simplar way is to use the glob function.  Say I wanted to delete all jpgs .........

<?php

foreach (glob("*.jpg") as $filename) {
   echo "$filename size " . filesize($filename) . "\n";
   unlink($filename);
}

?>

also

To delete files using wildcards:

<?
function delfile($str)
{
   foreach(glob($str) as $fn) {
       unlink($fn);
   }
}
?>

Regards,
Ramy
0
 

Author Comment

by:leronj23
ID: 16906410
i read that already, but do i make $str = "the name of the Folder"

<?
function delfile($str)
{
   foreach(glob($str) as $fn) {
       unlink($fn);
   }
}
?>

will this delete the "Folder" from the server?
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16906460
that case u can use rmdir()

http://www.php.net/rm_dir

Regards,
Ramy
0
 

Author Comment

by:leronj23
ID: 16906593
im sorry to be a pest. I read the link. but what would be the easiest way to write the script for me to delete the folder "Pictures" with everything in it.
0
 
LVL 7

Accepted Solution

by:
Ramy_atef earned 500 total points
ID: 16906696
not at all :)
but i think the code you want is in the same page

<?php

function remove_directory($dir) {
  if ($handle = opendir("$dir")) {
   while (false !== ($item = readdir($handle))) {
     if ($item != "." && $item != "..") {
       if (is_dir("$dir/$item")) {
         remove_directory("$dir/$item");
       } else {
         unlink("$dir/$item");
         echo " removing $dir/$item<br>\n";
       }
     }
   }
   closedir($handle);
   rmdir($dir);
   echo "removing $dir<br>\n";
  }
}

remove_directory("/path/to/dir");

?>

hope it works
regards,
Ramy
0
 

Author Comment

by:leronj23
ID: 16906759
You answer 2 question for me. If i could i would give you a 1,000,000 points thanks.

you helped me with the following:

if someone uploads a picture to my site. when they preview it. if they dont like it i use php to delete it from my "Tempupload" folder.

After 30 days when their time is up. i can write a php file to delete their whole folder from my site.

Thank you. This is the second time you helped me. Money will spent.
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16906794
Glade i could help :)

Ramy
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
free flash maker 5 222
Where to download Acrobat flash offline installer? 2 270
Missing Plugin for Firefox - Can't View Content 7 188
Running Mp4 or Flash Video 1 148
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question