Drupal: change path to uploaded files - drupal

I copied a site files to test host for further developement.
And I want uploaded files to be loaded from old host.
For example, files a re stored in drupal_folder/sites/default/files/ (example.com/sites/default/files).
I need this files to be accessible from other site (example.dev.com)
I mean I want to change path to all files on a new host (example.dev.com).
I tried to change path to all files in database with command
UPDATE `files` SET `filepath` = REPLACE(`filepath`, "sites/default/files/", "http://example.dev.com/sites/default/files/");
but URLs are like example.dev.com/http://example.dev.com/sites/default/files/ after this.
I hope it makes sence.
How can I do it?

Use ln to create the link to that directory if you are using linux.
http://linux.about.com/od/commands/l/blcmdl1_ln.htm

Related

Drupal Site configuration issues

Good day every one,
I am new in DRUPAL.
I am having problem with the drupal site.
I got the repository for the drupal site. I have successfully clone it and got every things and the database. I have uploaded the database to the local host server.
Now, I can see that initially the directory is like this
C:\wamp\www\test\site\docroot\sites\default\
Then when i first open the site through local host the directory automatically becomes like this
C:\wamp\www\test\site\docroot\sites\default\file
The "file" directory contains the empty folder of css, images etc/
which I believe is downloaded from the database for the first time.
The site is giving many console error like missing images etc.
Instead of having the empty folder in file directory there must be images and css files and everything I do not know what is wrong becs the folder should not be empty there must be files and and image sand css files and should be downloaded from the database when I first open the site.
Please help me to locate the problem.
Thank you very much.
Usually, you will put on git drupal core, modules and theme files.., basically everything except the files uploaded by user (admin). Those files are usually located at:
/sites/default/files
So, since they are not on git repo you need to copy them to your local environment from the working site (i.e. over (S)FTP).
If your "file" is not "files" dir I'm talking about then it's something specific to your site - don't know nothing about it.

Change the path where Apache WAMP access to PHPMyAdmin

We work with a WordPress in Apache but we need to work with the same DataBase and files in differents PCs.
To do this, I know how change the path where apache search the files (Wordpress in that case) where we put in a Dropbox but I don't know how I can change the path to PHPMyAdmin to add it in Dropbox.
Sharing phpMyAdmin files will not help you. What you need is a centrally located mysql server which is shared and accessed by different PCs (on which code is developed). If you just want to share the database file (with out collaborating) then you can just export the database in .sql format and upload it to dropbox for others collaborators to download and use.

no acces to .txt with Webmatrix ASP.NET

I got a tiny website for my company to check in which store a brand can be found.
The website uses a c# code to check .txt files in a subfolder.
It worked nice while I used a path like "C:\brands" on my pc but now I try to host the homepage so I changed the path to "~/App_Data/Brands/Normal" + StoreNames()[i] + ".txt".
But now I can't access the .txt files anymore.
The txt files are located in root/App_Data/Brands/Normal but the code is in root/App_Code. Could that be a problem?
Also I'm trying to access the files without any special permissions or an account.
The host is https://panel.sitecloud.cytanium.com/.
What do I need to get access to the files again?
It could be a problem with my code too because it doesn't work on localhost either (where it worked with an extern folder)..
Edit:
Okay, MapPath did the job! I just forgot to add MapPath also to
if(File.Exists(HttpContext.Current.Server.MapPath(sFilename)))..
Try to use HttpContext.Current.Server.MapPath to get the physical directory:
string data = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/TextFile.txt"));

where does drupal save images when you use cck and imagecache?

I am thinking in moving all JS and images from webserver to another server to mitigate the load on my webserver. then i will use parallel module to get this stuff from the other server.
now, currently i am using cck and imagecache modules. and i dont know where does drupal save the images.
i checked mysql (files table) and found something like this
Mysql>select filepath from files limit 2;
sites/default/files/2010413132344592734_2.jpg
sites/default/files/2010491910913580_5.jpg
i checked for such files but i didnt find anything like this in this directory!!
i inspected one of the images in one of my articles and found that this image is in one of the cache folders that have been generated automatically by imagecache module. i tried to delete this image from server and refreshed my page, imagecache recreated it.
now where did imagecach get this image from? where does drupal save my images??
Thanks for your help
Imagecache takes source images from whatever path is set in the files table, which is generally sites/default/files, the directory you listed. Your imagecache directory was within that directory, right? I think your files are probably in that directory and you just missed them for some reason. Directory listing cached in your FTP client, maybe?
For myself, it stores everything in the sites/default/files folder.
But, some settings to look at...
The File system path setting, located at ?q=admin/settings/file-system
The path settings for the particular field. Open the settings for the particular field, and look in the File path setting in the Path Settings fieldset.
If those settings are different, your file may be somewhere else. Otherwise, it's going to be in your sites/default/files folder.
Check the following locations
[...]\htdocs\drupal\sites\default\files\field\image
[...]\htdocs\drupal\sites\default\files\styles\large\public\field\image
[...]\htdocs\drupal\sites\default\files\styles\medium\public\field\image
[...]\htdocs\drupal\sites\default\files\styles\thumbnail\public\field\image
where [...] is the location of the htdocs folder inside your webserver container.
If you are using xampp then it could be C:\xampp183\htdocs............
Hope this helps !
In the drupal database, check the table "file_managed" and the column "uri" (which gives the uri to access the file either local or remote).
You might find a value like below .. (ignore the jpg name , that is only for my setup)
public://field/image/8_mayurkotlikar_tigress5.jpg
This shows the location of the image.

Downloading files

I am using asp.net/C#. I have a url to a folder on a remote server. In that folder are images that are all .jpgs. I don't know the names of the files, just that they are all .jpgs. How do I download all the .jpg images using asp.net/C# to a folder on my local hard drive.
Just to clarify. I am pulling files from a remote server and I am saving them to my local machine. I was given a web URL and told that the files I needed to pull down every night where .jpg image files. That's all I was told. I have no idea how I can get a list of files on a remote server with just the url to the folder.
Thanks
If it's a web URL, you'd have to depend on the web server giving you some sort of list of files. The format of the list could be almost anything.
Put it this way: using a browser or anything else, how would you as a human find out all the filenames?
Just to clarify, are you writing code on the server which has the files? If so, you can find out what files are present using Directory.GetFiles. What do you want the user to have to do at the local side?
If you could make your question a bit clearer it would really help.
Here is some concept code to work with
DirectoryInfo di = new DirectoryInfo("M:\MappedDrive");
FileInfo[] rgFiles = di.GetFiles("*.aspx");
foreach(FileInfo fi in rgFiles)
{
Response.Write("<br>" + fi.Name + "");
}

Resources