
nvidia
Members-
Posts
32 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
nvidia's Achievements

Member (2/5)
0
Reputation
-
Hi, i have created a form used to upload .jpg files onto my server under: www\shanghai2010\images. I am trying to validate the file that i upload already exists or not and if not, add the image file to the server. However, i have a .jpg image to test against in my www\shanghai2010\images\ folder but when i upload a file with the same name as the one in my server it ALWAYS goes into my success message: if(isset($_POST['action']) and $_POST['action'] == 'upload') { $description = mysqli_real_escape_string($link, $_POST['description']); $category = mysqli_real_escape_string($link, $_POST['category']); $file = ($_FILES['photo']['name']); $target = 'www/shanghai2010/images/'; $target .= basename($_FILES['photo']['name']); // Checkk if a file was actually uploaded if(!is_uploaded_file($_FILES['photo']['tmp_name']) ) { $error = 'Error, there was no file uploaded'; include 'error.html.php'; exit(); } //$dirname = "C:\\wamp\\www\\Shanghai_2010\\images"; //$dh = opendir($dirname) or die("couldn't open directory"); if(!isset($_FILES['photo'])) { include 'imageuploadform.html.php'; } else { if(file_exists($target)) { $error = 'This file already exists on the server'; include 'error.html.php'; exit(); } else { echo ($_FILES['photo']['tmp_name']); // move file to server echo 'success this file does not exist on server'; } } } ?> I've checked the file permissions on my windows machine and they are fine, but i don't understand why whenever i try to upload any .jpg file EVEN if it has the same name as the one in my server, it always goes into my success message. I believe therefore there is something wrong with the line: if(file_exists($target)) because php does not go into that section. While doing some googling, came across this code function recursive_file_exists($filename, $directory) { try { /*** loop through the files in directory ***/ foreach(new recursiveIteratorIterator( new recursiveDirectoryIterator($directory)) as $file) { /*** if the file is found ***/ if( $directory.'/'.$filename == $file ) { return true; } } /*** if the file is not found ***/ return false; } catch(Exception $e) { /*** if the directory does not exist or the directory or a sub directory does not have sufficent permissions return false ***/ return false; } //} // if(recursive_file_exists('imageuploadform.html.php', '/www/shanghai2010/')) { echo 'file found'; } else { echo 'File Not Found'; } which would check to see if a file exists in a directory. So i tested it aginast my file and everytime it would echo File Not Found. My php file called index.php resides in the folder shanghai2010, and ofcourse there is a folder called images with my single .jpg image used to test against. Please help if you can guys. I need expert opinon on this
-
Transferring my DB onto another WAMP server onto my external HD
nvidia replied to nvidia's topic in MySQL Help
Can anybody helpp?? -
Hi, i have WAMP installd on my home laptop which contains a database called, ijdb_v2. Now, i also have a external hardrive. If i install WAMP onto my external hd, and make sure it works fine, what is the easiest and quickest way of transferring my ijdb_v2 from my laptop onto my external hardrive which would contain my WAMP server? without having to recreate my db from scratch. Is this possible? Please help if you can
-
Unable to connect to phpmyadmin(WAMP)
nvidia replied to nvidia's topic in PHP Installation and Configuration
Yes hi, i did actaully change the root password at the mysql prompt thing, but i did not change it on the file you spoke off. After i found it and added my password, saved it and it worked straight away. Thanks a bunch -
Hi, i downloaded WAMP a while ago and i've been using the MYSQL console to connect and run my sql quries and create my tables ect. I know want to be able to use PHPMyAdmin to do all of this. So i clicked phpmyadmin and i saw the following error: Error MySQL said: #1045 - Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server. Now, i've been looking over the internet for solutions, but i've noticed that people are responding to these types of post referring to phpmyadmin as a standalone program and are therefore referring to different config files that are not in WAMP or are called differently. So, please can somebody tell me exactly how i can configure my WAMP to allow me to use phpmyadmin. p.s Please only reply with WAMP specific answers rather than answers assuming that i have a standalone phpmyadmin application because i do not as it does not help me. Thanks
-
Hi, i just installed a fresh version of Komodo IDE and i'm having trouble creating a project properly. When i create a project, it also loads my other files and folders into the same project automatically. Can somebody tell me why on earth it does this??? because i find it to be ridiculas. Thanks
-
Cool thanks
-
The code i have is <?php setcookie('test',45,time()+(60*60*24*7)); ?> . That is beside the point. All i simply like to know is where i would go IE Options to view the value.
-
Hi there i have a this piece of php code and i am setting the value for it. What i would like to know is, is it possible to view the value of the cookie by clicking on one of the options on IE because i have tried this with Firefox going tools>options>privacy>showcookies. How do i do this on IE anybody know?? Thanks
-
Hi just managed to solve it, i had blank spaces before my starting php tags. Thanks everybody, happy days.
-
Ok cool, i'll have a look at that, i WILL definitely get back to you in a few days or two, thanks everybody, and Hamza.
-
Hi thanks for your quick response. I have removed everything even the html code to be left with: <?php setcookie('test', 45, time()+(60*60*24*7));?> but i still get the message of Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\php_sandbox\cookies.php: 3) in C:\wamp\www\php_sandbox\cookies.php on line 3. Even with the HTML code, it should work right??
-
Hi, i have set a cooke using the following code: cookies.php <html> <head> <title>Forms</title> </head> <body> <?php // time(60 seconds in 1min,60 minutes in 1hr,24hrs in a day, 7days a week), it will expire in 1 week from now setcookie('test', 45, time()+(60*60*24*7) ); ?> </body> </html> but when i view this on my web browser[iE], i get the error message warning message saying Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\php_sandbox\cookies.php: in C:\wamp\www\php_sandbox\cookies.php on line 10. Would somebody tell me how to over come this please. Thanks
-
Hi, i have created a class A & B, where B extends A. What i am trying to do is call the parent class function, operation with the given code <html> <head> <title> Classname </title> </head> <body> <?php class A { var $attribute = "default value"; function operation() { echo "Something <br />"; echo "The value of \$attribute is $this->attribute <br />"; } } class B extends A { var $attribute = 'different value'; function operation() { echo "Something else<br />"; echo "The value of \$attribute is $this->attribute"; } parent::operation(); } $a = new A(); $a->operation(); $b = new B(); $b->operation(); ?> </body> </html> But evertime i run the script i get the following error message Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\wamp\www\php_sandbox\OOP\classname.php on line 30 can somebody tell me why this is happening and what i need to do to rectify it please. Thanks
-
I have partly solved my problem. The only thing i want to know is how to disable the oracle message Warning: ocilogon(): OCISessionBegin: ORA-01017: invalid username/password; logon denied in /home/eland/u1/kbccs/w1009048/public_html/RAD/C2/memberlogin.php on line 18 I have my own message that i can display "Sorry but cannnot connect to database" but unsure how to disable the warning. Anyone knows how to do this??