Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,327
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    But as I said to you earlier:

    Quote Originally Posted by tangoforce View Post
    Well that won't really help much. Unless you print the path to the image in the html, how do you expect to test it?
    you need to print the file path and filename in your html now instead of the static image you've hard coded.

    Please will you change this:
    <img src="<?php bloginfo('template_url'); ?>/images/pic_02.jpg" />

    To this:
    <img src="<?php bloginfo('template_url'); print $pic; ?>" />

    If you won't do that, then how do you expect to get this working?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  2. Users who have thanked tangoforce for this post:

    gazaian1 (09-20-2012)

  3. #17
    New Coder
    Join Date
    Aug 2011
    Posts
    52
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    A good way to debug PHP is to View Page Source and see what is missing in the HTML. I use FireFox to view the page source, I don't know about IE or Opera.



    ---
    Thanks alot i get this error when i put the full path of the image directory for the image to be uploaded to:

    Warning: move_uploaded_file(http://speedycarloans.ca/wp-content/...timonial/2.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in /home/jbeck451/public_html/wp-content/themes/speedy/testimonial_code.php on line 21

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpigr46X' to 'http://speedycarloans.ca/wp-content/themes/speedy/testimonial/2.jpg' in /home/jbeck451/public_html/wp-content/themes/speedy/testimonial_code.php on line 21
    Last edited by gazaian1; 09-19-2012 at 02:07 AM.

  4. #18
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,327
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    Thats because you can't use move_uploaded_file() to move files onto a http:// address like you have tried to do.

    Think about it for a moment.. If you could, you'd be able to upload files onto any part of facebook, codingforums, msn, yahoo etc that you wanted. Their servers are all password protected so do you really think PHP could move any file to any http:// address? No!

    You must provide a operating system path instead just like the ones in the error message itself.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  5. Users who have thanked tangoforce for this post:

    gazaian1 (09-20-2012)

  6. #19
    New Coder
    Join Date
    Aug 2011
    Posts
    52
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Thank you guys for the help i got through my issue by storing http and url in a variable then adding it to my out pay from the database to get a full path to source.

    Hope this helps someone else

    PHP Code:
    <?php   
                            $per_page 
    4;

                            
    $pages_query mysql_query("SELECT COUNT(id) FROM testimonial WHERE active='1'")or die(mysql_error());
                            
    $pages ceil(mysql_result($pages_query0) / $per_page);

                            
    $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
                            
    $start = ($page 1) * $per_page;
                        
                            
    $query mysql_query("SELECT id, name, comment, picture FROM testimonial WHERE active='1' LIMIT $start, $per_page") or die(mysql_error());
                            
    $count=mysql_num_rows($query);
                            
                            
    $uploadDir 'wp-content/themes/speedy/testimonial/'//Image Upload Folder
                            
    $path 'http://speedycarloans.ca/';
                            
    $fileName addslashes($_FILES['pict']['name']);
                            
                            
    $filePath addslashes$path $uploadDir $fileName);
                            
                            
                            
                            
    $count=1;
                            while (
    $query_row mysql_fetch_array($query)){
                            
    $pic=$query_row['picture'];
                            include(
    'path.php');
                            
    ?>
                            
                          <?php if($count==1){ ?>
                            <div class="boxhide">
                            <div class="testmon_box">
                          <?php ?>
                          <?php if($count<=1){ ?>    
                          <div class="TESMON_INNERBOX">
                           
                             
                                    
                          <div class="pic_block">
                                <?php if($pic !=$uploadDir){?>
                                    <img src="<?php echo $path $pic?>" />
                                <?php } else{?><img src="<?php bloginfo('template_url'); ?>/images/pic_02.jpg" /><?php ?>
                                
                          </div>
                            
                           <div class="test_cont_block">

                              <p> <?php echo $result=$query_row['comment']; ?></p>

                             <span class="danam"> 
                            Date of Posting: <?php echo date('l, F j, Y'); ?><br/>

                            <strong>Posted by: <?php echo $result=$query_row['name']; ?></strong>

                             </span>
                             
                           </div>
                                
                                 
                                 
                           <div class="clear"> </div>

                            </div>

                        

                            </div>
                           <?php }?>
                                  
                           <?php }?>
                         
                          <div class="pagin_nav">
                             <?php if ($pages >=&& $page <= $pages){
                               for (
    $x=1$x<=$pages$x++){
                                    echo (
    $x == $page) ? '<strong><a class="pagi" href="?page='.$x.'">'.$x.'</a></srtong> ' '<a class="pagi" href="?page='.$x.'">'.$x.'</a> ';
                                  
                               }
                             }
    ?>
                         </div>
                         </div>

  7. #20
    New Coder
    Join Date
    Aug 2011
    Posts
    52
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    Thats because you can't use move_uploaded_file() to move files onto a http:// address like you have tried to do.

    Think about it for a moment.. If you could, you'd be able to upload files onto any part of facebook, codingforums, msn, yahoo etc that you wanted. Their servers are all password protected so do you really think PHP could move any file to any http:// address? No!

    You must provide a operating system path instead just like the ones in the error message itself.
    Thanks for the help again i have another question how can i get a single result form a mysql database and have it automatically changed with ajax on the front end.

  8. #21
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    gazaian1 ..... Before you go further I highly recommend you clean up your code. It looks like you google bits of code and stick them together.

    You don't need all those PHP opening and closing tags, you have include('path.php') inside a database query loop, and I would take out all the tabs and spaces and indent the code in a more presentable way.


    --------------
    Leonard Whistler

  9. Users who have thanked Len Whistler for this post:

    gazaian1 (09-21-2012)


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •