Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

need help with php

Featured Replies

Hello,

over the past few days, i have been coding a script which uploads an excel file and adds each of the rows to the database. i was wondering if there was a way to batch upload images files with names like rowid-nameoffile.jpg, so that php reads the row id at the start of the image name and then adds it to an entry for that row.

 

is there anyway to do this while the excel file is being added to the database?

Thanks

Edited by Jaymul

Hello,

over the past few days, i have been coding a script which uploads an excel file and adds each of the rows to the database. i was wondering if there was a way to batch upload images files with names like rowid-nameoffile.jpg, so that php reads the row id at the start of the image name and then adds it to an entry for that row.

 

is there anyway to do this while the excel file is being added to the database?

Thanks

 

Hi Jaymul,

 

Sure this is possible, just upload the files via FTP to a specific folder on your server then write into your script a check for related image files in that folder each time it adds a row. You can use pattern matching functions such as preg_match to match the wildcards in the imagename and if you find a matching image then perform whatever action you want (store that images name in your database/copy the file to another location etc).

 

Cheers!

 

Dave

  • Author

Hi Jaymul,

 

Sure this is possible, just upload the files via FTP to a specific folder on your server then write into your script a check for related image files in that folder each time it adds a row. You can use pattern matching functions such as preg_match to match the wildcards in the imagename and if you find a matching image then perform whatever action you want (store that images name in your database/copy the file to another location etc).

 

Cheers!

 

Dave

 

thank you for your reply.

 

i understand i could do this by using the explode function such as

 

$picname  = "0001-piece2.jpg";
$pieces = explode("-", $picname);

foreach (array($pieces) as $value){
   echo $value[0];  // Prints 0001
} 

 

but i wondered how i would use this while in a loop for upload and processing the images

any ideas?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.