Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About TFT2012

  • Rank
  • Birthday 12/15/1980

Profile Information

  • Gender
  • Location
    Southern California
  1. I have the folder structure like: root application system assets uploads folder assets contains all css, img, and js. uploads contains user uploaded file. I set a "helper/assets_helper.php" file to define: define ('ASSETS_PATH', base_url().'assets/'); define ('UPLOAD_URL', base_url().'uploads/'); For all the css, img, and js, it works well like href="<?php echo ASSETS_PATH; ?>css/mycss.css" But when I display the uploaded images, it couldn't display image with <a href="<?php echo UPLOAD_URL;?>images/myupload01.jpg" ><img src="<?php echo UPLOAD_URL;?>images/myupload01.jpg" /></a> This uploaded image actually works fine with my localhost with the link like: http://localhost:9000/uploads/images/myupload01.jpg. But it couldn't display on my hosting server with like: http://users.mywebsite.com/uploads/images/myupload01.jpg Can anyone shed some light on it. Thanks!
  2. That's my first time to see this kind of issue. The PROD environment: Godaddy, IIS7, PHP5.4.30 The Local environment: Linux, PHP 5.5.X The framework: CodeIgniter 2.2.0 Process: I have view have form to update multiple files. echo form_open_multipart('admin/UploadFiles'); The controller will do an initial check, if( isset($_SERVER["CONTENT_LENGTH"]) && ($_SERVER["CONTENT_LENGTH"]>((int)ini_get('post_max_size')*1024*1024))) { $this->session->set_flashdata('upload_error', 'Your file is too big to handle.'); redirect($_SERVER['HTTP_REFERER']); } else { if($_FILES['files']['error'][0] != 0) { $this->session->set_flashdata('upload_error', 'There are no files selected.'); redirect($_SERVER['HTTP_REFERER']); } else { $photo_info = array(); $photo_info = $_FILES['files']; $this->load->model('uploadfile'); $results = $this->uploadfile->UploadImages($photo_info); // My debug echo "<pre>"; print_r($results); echo "</pre>"; // redirect($_SERVER['HTTP_REFERER']); } In my model file, for debug purpose, I only put these lines. Since I have traced the code line one by one, finally found the 500 error happens here. if (!empty($this->CheckFileError($images))) { $results['fail'] = $this->CheckFileError($images); foreach($this->CheckFileError($images) as $err) $error_idx[] = $err['index']; } It happens on empty($this->CheckFileError($images)) //$this->CheckFileError($images) is an array If I just "return $this->CheckFileError($images)", it has no error at all. But If I do the code above, it will give me Internal 500 error. After I change to count($this->CheckFileError($images)) == 0 everthing works. All the other logics in the actual model are remain same. I only change this line. It has no problem at all in my local. Only when I run it on my Godaddy IIS share hosting. Initially I thought the temp folder to hold the files is not writable. I even spent whole night to talk to Godaddy guys, but no progress. Even I tried create .user.ini to change the "upload_tmp_dir", it still gave me 500 error. Tonight, I debugged my code lines one by one, tested it in local first, then tested in Godaddy. Finally I found the root cause for my internal 500 error. However, I don't know why empty() will cause this issue. Can anyone explain it? I Googled, but didn't find any userful information. The reason why I use IIS is because I write my most of the services in WCF. Thanks!
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.