close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Best photo upload naming convention?

Thread began 10/26/2013 12:10 pm by Justin@AdventDesign | Last modified 11/05/2013 8:06 am by Justin@AdventDesign | 1506 views | 4 replies

weboholic

<?php require_once('Connections/db.php'); ?>
<?php
mysql_select_db($database_db, $db);
$query_rsGetNextID = "SELECT information_schema.`TABLES`.AUTO_INCREMENT FROM information_schema.`TABLES` WHERE information_schema.`TABLES`.TABLE_NAME = 'dbImages'";
$rsGetNextID = mysql_query($query_rsGetNextID, $db) or die(mysql_error());
$row_rsGetNextID = mysql_fetch_assoc($rsGetNextID);
$totalRows_rsGetNextID = mysql_num_rows($rsGetNextID);

// This is your next available ID for dbImages

$myNextID = $row_rsGetNextID['AUTO_INCREMENT'];

mysql_free_result($rsGetNextID);
?>

You have to replace dbImages (my table name) with your table name

As i said if this is a multi user environment you can not be sure that this is YOUR next ID.
Another user can insert a record and the next available ID change.

Better use Data Bridge to

1. Add a new record, Data bridge ask you for the session name for "Save Inserted ID in Session" - dbImagesInsertID for example
2. Insert file upload and use in file name my_file_name_<?php echo $_SESSION['dbImagesInsertID']; ?>
3. Update the record with imagename/filename/... using informations from the upload object in bindings panel

You can do this all in the same page.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...