[wp-trac] [WordPress Trac] #3117: lost of uploaded filepath of attachement

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 9 04:49:53 GMT 2006


#3117: lost of uploaded filepath of attachement
----------------------------+-----------------------------------------------
 Reporter:  kingbyu         |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:  2.1      
Component:  Administration  |     Version:  2.0      
 Severity:  normal          |    Keywords:           
----------------------------+-----------------------------------------------
 '''Description of bug'''
 I used the inline uploader to upload an attachment (PDF) file.  The file
 is uploaded into an uploads directory. When clicking the "using filename"
 button in the inline uploader options menu, the upload-directory path
 portion of the url is lost, leaving only the file name.  For example, when
 the url should be:
 http://example.com/upload-directory/myupload.pdf
 it instead is just:
 myupload.pdf

 '''Problem code:'''
 The problem comes from an incorrect ab entries which are created from a
 line in trunk/wp-admin/inline-uploading.php (currently line 251) which
 looks like:
 {{{
 ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\"
 onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 }}}
 The problem is that a few lines earlier $filename was set with:
 {{{
 $filename = basename($attachment['guid']);
 }}}
 and the basename() function took off all of the path part of the URL.

 '''Suggested fix:'''
 Change line 251 to be:
 {{{
 ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$attachment['guid']}\"
 onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 }}}
 so that the full filename is preserved.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3117>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list