
xeirus
Members-
Posts
39 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
xeirus's Achievements

Newbie (1/5)
0
Reputation
-
in_array gives Wrong datatype for second argument
xeirus replied to xeirus's topic in PHP Coding Help
Forget it guys, false alarm! The problem was with my "post_max_size" setting, used php.ini to change it from 8M to 100M and now I can upload even 20 pics at a time, in other words, any number of files as long as they don't exceed the 100M mark. -
Hi! I have the following code for quick verification of uploaded files: // Validating the Image (file_upload) if (in_array("", $_FILES['file_upload']['name'])) $errorArray['Image File'] = "Browse and select a GIF/JPEG Image File to upload!"; elseif (isset($_FILES['file_upload'])) { foreach ($_FILES['file_upload']['type'] as $key => $type) { if (!($_FILES['file_upload']['type'][$key] =="image/jpeg" OR $_FILES['file_upload']['type'][$key]=="image/gif")) $errorArray['Uploaded Image'] = "Your uploaded file must be either JPG or GIF only!"; elseif (!doesuserfile_nameEventBannerExist($_FILES['file_upload']['name'][$key])) $errorArray['Uploaded Image'] = "Filename already Exists, Rename and Upload again!"; } } I can upload 7 files at one time and there's no error. More than 7 files at one time, I get an error saying: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/user/imageuploader.php Please help ! Thank you.
-
Hi PFMaBiSmAd, Yes, just that multipart spot. Since then, I knew that I was losing things here and there so I have done a line by line check of the code. It is correct. The only difference is the DocType. Files I'm trying to upload are about 200kb (actually lesser, but not more). I'll keep trying and thanks for your help, I do appreciate every bit of it!
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
PFMaBiSmAd, Found out two issues, one was completely my fault, I forgot to put the following in the opening form tag: enctype="multipart/form-data" The only issue I'm stuck on is that when I use the following for my DocType, the upload does not work: <!DOCTYPE HTML> But if I use the following DocType, it works just fine: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> To answer your questions: post_max_size is set to 8M and I'm trying to upload a jpg image of about 200kb file_uploads are ON max_file_uploads is set to 20
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
Sorry, I meant that the modified code provided by kicken in post #4 does not work. I have error reporting turned fully on and there's no error. And the only validation error I get from the form is: Image File: Browse and select a GIF/JPEG Image File to upload!
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
Thanks Kicken. But doesn't work either. Any other ideas?
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
Hi Christian, Turned error reporting on and this is the error I'm getting: Notice: Undefined variable: userfile_type in /home6/user/public_html/eventbanner_uploader.php on line 70
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
Hi all! I'm going through a very strange problem. I have an identical code on BlueHost and GoDaddy. On BlueHost it does NOT work and on GoDaddy it works just fine. Both BlueHost and GoDaddy are using PHP v5.2.17 The code is: // Validating the Image (userfile) if (empty($userfile)) $errorArray['Image File'] = "Browse and select a GIF/JPEG Image File to upload!"; elseif (!($userfile_type =="image/pjpeg" OR $userfile_type=="image/gif")) $errorArray['Uploaded Image'] = "Your uploaded file must be either JPG or GIF only!"; elseif (!doesuserfile_nameEventBannerExist($userfile_name)) $errorArray['Uploaded Image'] = "Filename already Exists, Rename and Upload again!"; Please help ! Thank you
- 10 replies
-
- $userfile_type
- $userfile_name
-
(and 1 more)
Tagged with:
-
Hi Drummin and PFMaBiSmAd, I've been breaking my head with this for over a month but I can't get the code to display the events I have entered in the DB. I've also tried changing event_date to DATE but still, it doesn't pull out the events. Please help!
-
Thanks a lot, Drummin! Done Your calendar looks nice and clean. Would you mind sharing your code? But if not, its ok, I understand some people don't like making their code public. Also, one more question, hopefully last: Is there an easy way to add the week number in the code we have above? Or would that require a lot of programming? Kind Regards, Xeirus.
-
Wow! It worked like a charm, Drummin Changed those two lines and the calendar is showing. Just one question ... In this line: $result = mysql_query($query) or die('cannot get results!'); Can I put something like this: $result = mysql_query($query) or die('cannot get results! .mysql_error()'); So if there's an error then I would know the exact error. I really liked your use of that mysql_error() in your DB Login example, that's what helped the hosting people find the problem so easily (by telling us openly that the user didn't have enough rights).
-
Changed event_date to VARCHAR(10)
-
Hi Drummin, Yes, the DB was created with those fields. Finally it was the hosting company's problem. They had to add the rights for me to use the DB although I had created a DB user and added that in cPanel as well. But anyway, the previous error is gone. The PHP script didn't come with a SQL script but the author had made a statement in his post that one needs to create the SQL Table with a couple of fields title (which I have kept as text) and event_date needs to be set as DATE or DATETIME, I used DATE And I went a step ahead and added id with auto increment.
-
Thanks again Drummin. I added your code, its just above the main code and this is the error I'm getting: Access denied for user 'db_username_here'@'localhost' to database 'db_name_here' Do you think this has something to do with my hosting company? Please advice.
-
Thank you Drummin. That took care of the error. But now I'm getting: cannot get results! Any idea why that would be? The above error would be the outcome if $dbcnx was not there or not working but I have it in there.