• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cant get photo to upload.

The CodeIgniter User Guide shows how to do this.

Do this, otherwise go by the User Guide and start over.

PHP Code:
// change this
public function drinkadvert()

// to this
public function do_upload() 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

(10-03-2020, 10:20 AM)InsiteFX Wrote: What is the name of the controller that the function is in?

PHP Code:
<?php echo form_open_multipart('controllerName/drinkadvert'); ?>

Change controllerName to the name of your controller that the drinkadvert is in.

Ive found what I think was an error. The working page that has these functions have the following variable with a different name;

PHP Code:
$drinkphoto 'mem/'.$lcuser.'/adverts/'.$drink/$img['file_name'];
$drinkpic 'mem/'.$lcuser.'/adverts/'.$drink/$img['file_name'];

$_FILES['drinkphoto']['name']) && $_FILES['drinkphoto']['name']!="")
$_FILES['drinkpic']['name']) && $_FILES['drinkpic']['name']!="")

$mime get_mime_by_extension($_FILES['drinkphoto']['name']);
$mime get_mime_by_extension($_FILES['drinkpic']['name']); 

But that did not solve my problem. However, it may lead to a resolution.

I also had a similar situation

Ive found the root of my problem but not solved it.

I am able to upload fwrite data then redirect to photos upload, but the problem with that is if the $product name is omitted or different the fwrite & photos are not together, and that is unsatisfactory. I would prefer to have both in the same operation but that is impossible. The root of that problem is in the view page where the fwrite requires the first coding & the photo upload requires the second, and they are not interchangeable.

PHP Code:
<?php echo form_open('pagename'); ?>
echo form_open_multipart('pagename'); ?>

If the $product variable in the fwrite can be transferred to the photos upload, then that could be lived with, but redirect to the finished advert will be required.

I would prefer when the photos are uploaded then to redirect to the finished advert, but that is impossible because the photos upload will not redirect. Although I have another operation with a small amount of fwrite plus a pdf document upload and that redirects with no problem.

I have spent the last 4 months trying to resolve this issue, probably spent 1,000 hours plus, and still havent achieved a resolution.

By the way the coding in the UserGuide detailing uploads is faulty, by undefined variables, but when those variables are deleted it works but not with a combination of fwrite & photo uploads.

The problem appears to be a fault within CodeIgniter, so there needs to be someone who understands their coding & be able to fix the problem.

Ive found the problem. When uploading data with photos you must keep separate in form_validation the data from photos. Just make two separate form_validations.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.