I'll be uploading a rather large amount of content, which includes images. I'd like to have them upload into separate directories, but thus far everything is still dumping into "files" (instead of "files/items").
I'm doing all this with node_save programmatically, bu the settings on the image field is "files/items". I cleared the cache, on a local dev so not concerned about file permissions (and that should throw it's own error if it's an issue), so I'm not sure what I'm missing.
Here's how my image code looks:
$img_name = "public://".$p['prodid'];
$image_link = "http://website.com".$p['image'];
$image = file_get_contents($image_link);
$file = file_save_data($image, $img_name, FILE_EXISTS_REPLACE);
$node->field_image['und']['fid'] = $file->fid;
$node->field_image['und']['alt'] = $p['product_name'];
Is there something in there I should change? I tried adding "files/items" to the "public://" but just caused some errors. What can I change to my code to get the images to upload into a sub folder instead of files?
Adding "items" to "public://" is all I needed to do.