PHPycho
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by PHPycho
-
-
Hello forums !!
How to rewrite in this case:
i had the following case:
if i had the following url: http://localhost/my_project/test/create
I would like to map this url with http://localhost/my_project/index.php?url=/test/create/
So that its easier to retrieve the params using $_GET['url'] and everything will go fine.
Note: i would like to have url rewriting for mvc pattern
How it could be performed? thanks in advance.
-
Hello forums
Now i am totally shifting towards OOP..
I had tried to make a upload class but it didnt worked .here is the code
uploader.class.php
<?php class uploader { var $uploadDir; var $thumbDir; var $newFileName; /*var $file_name; var $file_type; var $file_size; var $file_temp_dir;*/ var $fileInfo = array(); var $maxFileSize; var $allowTypes = array(); var $errMsg = ""; var $suMsg = ""; /***/ var $fileExt; function getExtension() { $fileExt = explode(".",$this->$fileInfo['name']); $this->fileExt = $fileExt[1]; } function checkTypes() { if(!in_array($this->fileInfo['type'],$this->allowTypes)) { return FALSE; } else return TRUE; } function doUpload() { // Check the Size /* If fileSize > maxSize */ if($this->fileInfo['size'] > $this->maxFileSize) { $this->errMsg .= "File Size is larger<br />"; } /* If fileSize == 0 */ else if($this->fileInfo['size'] == 0) { $this->errMsg .= "No file uploaded <br />"; } /* Check the Types */ else if(!$this->checkTypes()) { $this->errMsg .= "Invalid file type !! <br />"; } /* If everything goes fine then Upload */ else { //upload to destDir echo "Final step"; $uploadPath = $this->uploadDir."/".$this->fileInfo['name']; move_uploaded_file($this->fileInfo['tmp_name'],$uploadPath); //finally rename $ext = $this->getExtension(); $newUploadPath = $this->uploadDir."/".$this->newFileName.".".ext; if(rename($uploadPath,$newUploadPath)) { $this->suMsg = "Sucessfully Uploaded & Renamed !!"; } } } function deleteFile() { } function renameFile() { } } ?>
action.php
<?php if(isset($_POST[] ...) { include "uploader.class.php"; $uploaderObj = new uploader(); //assign all the variable properties of uploader.class.php $uploaderObj->doUpload(); } ?>
But nothing happens
What i want ?
1>Any techniques for checking how the class is working ie any debugging tips
2>Any changes in above code to make it efficient and effective Note: its for PHP4 ie any tips n modifications
3> when i try to echo $uploaderObj->getExtension(), it gives the follwing error
Fatal error: Cannot access empty property in C:\Program Files\xampp\htdocs\designtoko\libs\uploader.class.php on line 21
and why it is so
Thanks for reading my post.
Thanks in advance to all of you and awaiting for the results...
How to rewrite this ??
in Apache HTTP Server
Posted
knock knock..
call for help..