Restricting file upload to .jpg
Moderator: General Moderators
-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
Restricting file upload to .jpg
I have built a file upload for a client and find that the form I have used uploads both jpg and JPG extensions, however they are then all displayed as jpg.
Is there any way of limiting the file extension to jpg so others will not be uploaded by mistake.
Is there any way of limiting the file extension to jpg so others will not be uploaded by mistake.
-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
err well sorry to dig up old posts, but my problem is the way in which the form works, I'll prob use $_File[][type]
would this work with
thanks andy
would this work with
Code: Select all
if($_Fileї$upload]ї.jpg]){
perform upload
}else{
echo "e;file extension must be .jpg"e;;
}-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
basically what happens is that the user uploads the images, but the extension of the thumbnail has to be the same as the actual image. My client is uploading the thumbnails as .jpg which is great but is uploading the photos as a mess between .JPG and .jpg and the page that reads the files is designed to only read .jpg .This is to save my client time when he chooses which images to put in the gallery he has on his site.
So he uploads an image into a thumbnails folder
He then uploads the corresponding image to the correct gallery folder
He then types the order he would like the images to show into a form and then these are read from a txt file
The files are typed into the form as a filename and the extension .jpg is added to the names.
These names are then read from the file in the gallery
When the user clicks an image it takes him to the correct image, which has to be .jpg
So he uploads an image into a thumbnails folder
He then uploads the corresponding image to the correct gallery folder
He then types the order he would like the images to show into a form and then these are read from a txt file
The files are typed into the form as a filename and the extension .jpg is added to the names.
These names are then read from the file in the gallery
When the user clicks an image it takes him to the correct image, which has to be .jpg