Hi,
I noticed that the uploaded form files disappear after a while and the URLs of uploaded files are shown as an internal absolute path which leads to broken links. (I'm using private file system.)
The first issue seems to be happening because of calling file_save_upload() without calling file_set_status() makes the uploaded files temporary and cleaned by Drupal(http://api.drupal.org/api/function/file_save_upload/6)
The second issue is caused by local method fillpdf_fix_url() and use of generic file_create_url() is fixing it.
214,221d213
< function fillpdf_fix_url($url){
< $url = rtrim(ltrim($url, '/'), '/');
< if (!valid_url($url, TRUE)) { //if they used drupal-relative URL
< $url = 'http://'. $_SERVER['SERVER_NAME'] .'/'. $url;
< }
< return $url;
< }
<
226,229d217
< if($url=$form_state['values']['url']){
< $url=fillpdf_fix_url($url);
< form_set_value($form['pdf']['url'], $url, $form_state);
< }
237a226
> file_set_status($file,1);
245c234
< $form_state['values']['url']=fillpdf_fix_url($file->filepath);
---
> $form_state['values']['url']=file_create_url($file->filepath);
Sincerely,
Alex
Comments
Comment #1
dlx commentedComment #2
lefnire commentedperfect! will look at very soon (finals week, then home-free!)
Comment #3
lefnire commentedGood call on #1
For #2, it looks like file_create_url($file->filepath) would turn 'something.pdf' into 'http://mysite.com/sites/default/files/something.pdf', which is good... except it mangles urls that they might enter manually if the pdf is located off site.
I think the problem is my allowing both an upload or a manual URL entry. Do you think anyone would be using the latter, think it's safe for me to just make it an upload and take away the manual URL field?
Comment #4
dlx commentedHi,
I think that manual URL makes sense for people that might have some sort of a storage node that has all the pdfs attached to it. So I would say you'd need both fields.
Alex.
Comment #5
lefnire commentedomg alexbiota. I just went down a path with a bunch of users loosing their PDFs, and manually discovered this bug after trial-and-error. A year later, I can't believe I *totally forgot about this issue* that you've already reported! God I'm stupid. Anyway, fixed :s