close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

upload images - preg_replace

Thread began 4/12/2013 1:04 pm by paulshoe379536 | Last modified 4/13/2013 7:58 am by paulshoe379536 | 713 views | 3 replies |

paulshoe379536

upload images - preg_replace

I am using the statement below to clean up an image file name before it's uploaded. I seem to be getting an occasional server error an my images are sometimes pixelated. I don't know whether it's my code or the server that causing the problem. What's the best way to rename the uploaded file?

Renaming code at the top of the page:
------------------------------------------------------
if(isset($_FILES['item_photo']['name'])) {
$_FILES['item_photo']['name'] = preg_replace('/[^A-Za-z0-9.]/','_',$_FILES['item_photo']['name']);
}

Sign in to reply to this post

Jason ByrnesWebAssist

what is the error?

I dont believe that code has anything to do with the error, more likely it is a server memory issue.

Sign in to reply to this post

paulshoe379536

Thanks Jason

Sign in to reply to this post

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...