Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > BlueVoda Website Builder Forums > Forms

Notices

Forms Discussion and help related to designing and implementing forms in the BlueVoda Website Builder.

Reply
 
LinkBack Thread Tools
  #1  
Old 04-05-2008, 06:45 PM
Second Lieutenant
 
Join Date: Feb 2008
Posts: 124
Default changing image name after uploading

Hello
does anaybody know how can i add a line of code that will change the name of the image uploaded to avoid similarity cus then the computer delete and overwrite the old file.

can i add it to the ABVFP ?
can i add the Record_Nr that always increasing ?(and like that it will never be the same)

thanks

*the code
Code:
//--------- Move the files to destination----------------
$nduploadfolder1 = basename($nduploadfolder);
for ($i = 0; $i < count($upload_Name); $i++) {
if ($upload_Size[$i] < $ndfilesize1 and $upload_Size[$i] >0)
{
$uploadFile = "$nduploadfolder1/".$upload_Name[$i];
if (!is_dir(dirname($uploadFile)))
  {
    @RecursiveMkdir(dirname($uploadFile));
  }
else
  {
  @chmod(dirname($uploadFile), 0777);
  }
@move_uploaded_file( $upload_Temp[$i] , $uploadFile);
chmod($uploadFile, 0644);
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 04-05-2008, 10:00 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

Make it:

$nduploadfolder1 = basename($nduploadfolder);
for ($i = 0; $i < count($upload_Name); $i++) {
if ($upload_Size[$i] < $ndfilesize1 and $upload_Size[$i] >0)
{
$uploadFile = date(Y_m_d)."_$nduploadfolder1/".$upload_Name[$i];
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $upload_Temp[$i] , $uploadFile);
chmod($uploadFile, 0644);
}
}

You can't use the Record_id, unless you
1. Move the file moving code AFTER the database INSERT command
2. Add a line, just after the insert query: $Recordid = mysql_insert_id;
2. Make the line i added above:
$uploadFile = $Recordid."_$nduploadfolder1/".$upload_Name[$i];
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 04-06-2008, 01:15 AM
Second Lieutenant
 
Join Date: Feb 2008
Posts: 124
Default Re: changing image name after uploading

hi
no need for the id # as long as it will give to it a different appearence and wouldnt over write another file.
but i though about if the same file name would be uploaded in the same day ?!

can we make it as a random number or something like that ?

instead of that :
$uploadFile = date(Y_m_d)."_$nduploadfolder1/".$upload_Name[$i];

well do :
$uploadFile = rand()."_$nduploadfolder1/".$upload_Name[$i];

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 04-06-2008, 07:57 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

Yes, you can use that, but this way you will have no reference of where the file belongs. The use of the record id ill provide a direct relationship among the database record and the file itself.

This is a good idea and i will adopt it for ABVFP. Look for the updated code later in the day. I will post in this same thread to let you know.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 04-06-2008, 01:39 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

I have updated the script that is now using a 10 chrs prefix for the uploaded files names. I did not use rand() for reasons of my own, neither the Record id (there are users that don't store the info in the database, so no Record id exists) but i believe that this is not important to you.

You can now download the updated version from my site
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 04-06-2008, 01:42 PM
Second Lieutenant
 
Join Date: Feb 2008
Posts: 124
Default Re: changing image name after uploading

hi
thanks alot.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 04-06-2008, 02:07 PM
Second Lieutenant
 
Join Date: Feb 2008
Posts: 124
Default Re: changing image name after uploading

works fine...thanks again
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 04-06-2008, 03:15 PM
kadm's Avatar
Sergeant
 
Join Date: Mar 2008
Location: Vryheid South Africa
Posts: 22
Send a message via Skype™ to kadm
Default Re: changing image name after uploading

Hi,
My file that i upload does not save and/or make i directory.
When i recieve the email it does not contain any fiel/or referance, can you help please Kurt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 04-06-2008, 03:37 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

Hi Kurt,

There have been QUITE a lot of changes in ABVFP lately, and at a certain point it would not save. If you downloaded at that moment, there might be an issue.

Please download the zip now, and replace only the file dbts_abvfp.php
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old 04-06-2008, 08:34 PM
kadm's Avatar
Sergeant
 
Join Date: Mar 2008
Location: Vryheid South Africa
Posts: 22
Send a message via Skype™ to kadm
Default Re: changing image name after uploading

Hi Navaldesign,
I am busy taking your advise and let you know later. By way Thanks for putting so much effort in, we really appreciate it. Keep well Kurt.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old 04-06-2008, 10:56 PM
kadm's Avatar
Sergeant
 
Join Date: Mar 2008
Location: Vryheid South Africa
Posts: 22
Send a message via Skype™ to kadm
Default Re: changing image name after uploading

Hi Navaldesign,
Wow great work you did, it is working perfect now, except for a small detail.
If the cofirmation email is sent, it has no " from " email and it is blank. How could we insert the "from email " in.
I know that i recieve alot of spam emails.
If the "email address" (From :) has nothing in it, then it throws it spam.
Thank you in advance, Kurt.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old 04-06-2008, 11:09 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

Fixed! Thank you.

Please download again and replace once more the file. dbts_abvfp.php. Sorry!
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old 04-07-2008, 09:49 PM
kadm's Avatar
Sergeant
 
Join Date: Mar 2008
Location: Vryheid South Africa
Posts: 22
Send a message via Skype™ to kadm
Default Re: changing image name after uploading

Thanks Naveldesign,
Once again the master has done it again, works Excellently.
Wonder if you could help me with our next problem, looked all over, did'nt seem to get a solution.
I have made a small employee data base, requesting 1) name 2) email 3) phone and picture to be added of employee.
Created data base as employees yet if it goes to the php page it gives thiabout47fa72e8723c57.85659106
184714942547fa72e8723ec5.61369709
dcc9b91a57cc1b899c0f9eb23adee59a
Warning: move_uploaded_file(images/favicon.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/sgfcjgmq/public_html/employees/add.php on line 65

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpbyWgqh' to 'images/Jill.png' in /home/sgfcjgmq/public_html/employees/add.php on line 65
Sorry, there was a problem uploading your file. > s error.
Could you help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old 04-07-2008, 10:06 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,357
Default Re: changing image name after uploading

I can't know what the structure of your script is and if it defines as temp folder something else than the default temp. So i can't really give you a good answer.

The error message says that it simply doesn't find the uploaded file, but it doesn't give any info on the reason. Also it would be necessary to analyze the function move-uploaded-file to see how it works and why it causes the problem.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old 04-07-2008, 10:25 PM
kadm's Avatar
Sergeant
 
Join Date: Mar 2008
Location: Vryheid South Africa
Posts: 22
Send a message via Skype™ to kadm
Default Re: changing image name after uploading

Ok i have being working on it a bit here is the page html
<?php
//creates a unique id with the 'about' prefix
$a = uniqid(about);
echo $a;
echo "<br>";
//creates a longer unique id with the 'about' prefix
$b = uniqid (about, true);
Echo $b;
echo "<br>";
//creates a unique ID with a random number as a prefix - more secure than a static prefix
$c = uniqid (rand (),true);
echo $c;
echo "<br>";
//this md5 encrypts the username from above, so its ready to be stored in your database
$md5c = md5($c);
echo $md5c;
?>
<?php
//This is the directory where images will be saved
$target = "images/";
$target = $target . basename( $_FILES['photo']['name']);
//This gets all the other information from the form
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$pic=($_FILES['photo']['name']);
// Connects to your Database
mysql_connect("localhost", "sgfcjgmq_admin", "admin") or die(mysql_error()) ;
mysql_select_db("sgfcjgmq_employees") or die(mysql_error()) ;
//Writes the information to the database
mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}
?>
and it gives this error now

about47fa8171b58a96.26254278
37176010047fa8171b58cc8.04798424
115fae05c49aeb07404d2c98b0c849c5 Sorry, there was a problem uploading your file. >
Thank you register and photo uploaded
Access denied for user 'sgfcjgmq_admin'@'localhost' to database 'sgfcjgmq_employee'

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 11:51 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52