Rank: Member
Groups: Member
Joined: 3/22/2008(UTC) Posts: 13
|
Hello, I'm trying to use Image uploader with multiple upload dir. A new dir is creat when a new upload is done. But i want to recover my upload dir and to get it in the url. A sort of : Quote:iu.addParam("RedirectUrl", "index.php?p=galerie&rep=[fileName]") Any ideas ? Thanks and sorry for my English.
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Hi, Do you want to generate some folder name in your upload script and redirect user there after upload, right? I hope this small snippet will be helpful: Code: <script language="javascript">
function ImageUploader_AfterUpload(Page)
{
window.location = Page + "/RequestDump.txt";
}
var iu = new ImageUploaderWriter("ImageUploader", 800, 400);
iu.addParam("Action", "Upload.aspx");
iu.addParam("ShowDebugWindow", "true");
iu.addEventListener("AfterUpload", "ImageUploader_AfterUpload");
iu.writeHtml();
</script>
Server code: Code:void Page_Load()
{
String folderName = System.Guid.NewGuid().ToString();
System.IO.Directory.CreateDirectory(Server.MapPath(folderName));
Request.SaveAs(Server.MapPath(folderName + "/RequestDump.txt"), true);
Response.Write(folderName);
}
|
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/22/2008(UTC) Posts: 13
|
Hello, Thanks for your reply, yes iam trying to do this. I use PHP langage how can I adapt the snippet ? Edit : I add a function ImageUploader1_AfterUpload in my page and i create a text file who contains the new directory name. I'm trying to obtain it in my function. Edited by user Monday, May 26, 2008 12:48:42 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/22/2008(UTC) Posts: 13
|
It's ok !! Is use that : In index.php file : Quote:<?php //Creat random nomber $rep = rand(); ?> ... //Configure URL files are uploaded to. iu.addParam("Action", "upload/upload.php?rep=<?php echo $rep; ?>") ... //Configure URL where to redirect after upload. iu.addParam("RedirectUrl", "index.php?p=galerie&rep=<?php echo $rep; ?>") In upload.php file : Quote:$rand = $_GET['rep']; mkdir ("Gallery/".$rand, 0600); $galleryPath = "Gallery/".$rand."/"; $absGalleryPath = realpath($galleryPath) . "/"; mkdir($galleryPath."Thumbnails", 0600); $absThumbnailsPath = realpath($galleryPath . "Thumbnails/") . "/"; Thank you !
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
|
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.