Remove Commas in Titles for LightningMp3.com Upload

  • Thread starter Thread starter nzausrec
  • Start date Start date
nzausrec

nzausrec

Member
Recently I uploaded a song with LightningMp3.com and it didn't work, but removed the comma from the title (possibly have to remove hyphens, too?) and it worked.

The comma adds a / in the title and in the url.
 
I've never considered it particularly great practice to put commas in file names.
 
I've never considered it particularly great practice to put commas in file names
I was supposed to mean using an apostrophe rather than a comma. I imagine same sort of problem occuring ...?
 
I was supposed to mean using an apostrophe rather than a comma. I imagine same sort of problem occuring ...?

Yeah I'd say the same about apostrophes.

The only symbols I use in filenames are hyphens and underscores.
 
You shouldn't make fun of me about this as there was someone on the board recently with this same problem. It's not common knowledge.

 
Yeah, there is a flaw in the programming logic. I'm hoping to have it fixed pretty soon. Any / that end up in the file name confuse the server. :(
 
^
You're the person who does http://www.lightningmp3.com? I want to say 'Thanks' as it really is a good set up. It's easy to upload, faster than s/click, auto deletes after 90 days .... and ... no degradation by resampling or by using an inferior imbeded player, like Box does, but uses the player that people already chose to use on their own pcs.

I think apostrophes/commas/punctuation in any file name causes problems for links as a natural part of the computer language.
It's just that Lightningmp3 being such a good site and an accessible site for us here I wanted to share what I found on uploading.
 
Yeah I'd like to give some props to NL5 too. Lightningmp3 is to me the most simple solution for posting music. You upload it, you get a link and that's that. No messing around with user accounts and trying to remember your password. The way it works seems nice and secure too. And NL5 has always been good with any technical queries.

So cheers NL5 dude! :) You da man! :p


You shouldn't make fun of me about this as there was someone on the board recently with this same problem. It's not common knowledge.

I really am pretty sure he wasn't making fun. I think it was just a friendly 'hehe'. I certainly didn't read it like that. Your query was perfectly valid and I can't see that anyone would take any exception to that. Peace dude. :)
 
Yeah, there is a flaw in the programming logic. I'm hoping to have it fixed pretty soon. Any / that end up in the file name confuse the server. :(
Lemme guess...PHP or Perl thinks it's signifying a control character. ;) I know the feeling. I had problems initially adding mshilarious to the author's database on my website because the apostrophe in his last name was choking the standard scripts I was using at first.

I agree with legionserial; hyphens or underscores are the only non-alphanumeric characters that I would use in computer filenames.

G.
 
I never use spaces in my file name either, but that's just a convention from Win 3.1/DOS, my first OS.
 
Anyone know how to add PHP code to strip non alpha numeric characters from file names being uploaded?

edit - actually - here it is, but why isn't it working?

$corrected_file_name = ereg_replace("[^a-z0-9._]", "", str_replace("%20", "_", strtolower($file_name)));

Help!
 
NL5, I'm not positive, as I use preg_replace most often, but with preg_replace you need to slash the open bracket and the closing quote in the search string so that the function doesn't try to treat them as literals to search for.

In your code, - assuming that ereg works the same way - it would look something like this:

$corrected_file_name = ereg_replace("/[^a-z0-9._]/", "", str_replace("%20", "_", strtolower($file_name)));

Even if that systax is not 100% correct for ereg, I suspect the class of problem is the same, that ereg is confusing which search characters are syntactical characters and which are actual search terms.

HTH - let me know how it works out for you.

G.
 
NL5, I'm not positive, as I use preg_replace most often, but with preg_replace you need to slash the open bracket and the closing quote in the search string so that the function doesn't try to treat them as literals to search for.

In your code, - assuming that ereg works the same way - it would look something like this:

$corrected_file_name = ereg_replace("/[^a-z0-9._]/", "", str_replace("%20", "_", strtolower($file_name)));

Even if that systax is not 100% correct for ereg, I suspect the class of problem is the same, that ereg is confusing which search characters are syntactical characters and which are actual search terms.

HTH - let me know how it works out for you.

G.


Hmmmm. I tried it, and it didn't work. Not sure if maybe that section of code isn't even being used maybe? I dunno. I don't know anything about PHP.

The weird thing is, that it uploads comma's just fine for me, and Windows won't let me put a \ or / in the filename. Somehow people are doing it, because that issue has been known to me for awhile.

I also need to know how to strip Chinese characters out as well. They cause havoc sometimes as well........
 
Hmmmm. I tried it, and it didn't work. Not sure if maybe that section of code isn't even being used maybe? I dunno. I don't know anything about PHP.
Check your server via your FTP client and look in the folder in which the PHP script resides. If the server is setup with this option (it should be) if there is an actual PHP error, it should show up in an error log file in that folder.

As far as that part of the code being used or not, I couldn't say from here, of course. The way to check for that depends upon how you're testing the code. You you have a local test server set up on your PC as a test environment, or are you manually running the code on your production server via TTY terminal software, or are you just running the production process as if you were a user and seeing what happens?

G.
 
Check your server via your FTP client and look in the folder in which the PHP script resides. If the server is setup with this option (it should be) if there is an actual PHP error, it should show up in an error log file in that folder.

As far as that part of the code being used or not, I couldn't say from here, of course. The way to check for that depends upon how you're testing the code. You you have a local test server set up on your PC as a test environment, or are you manually running the code on your production server via TTY terminal software, or are you just running the production process as if you were a user and seeing what happens?

G.

Checked the error log, and there are no entries since 2005 - so maybe it's not working right either? Do you know how to turn it on?

As far as testing, I am changing the code, then acting as a user and uploading files to the server and seeing what gets emailed to me, and if the links work......

Sorry, I really suck at PHP..... :(
 
It would be more simple to write instructions on upload something like: "Please write with alphabet letters and include no ' , / ~ type punctuation."
 
Checked the error log, and there are no entries since 2005 - so maybe it's not working right either? Do you know how to turn it on?
If there's an error log file there, it's configured to work that way. AFIK, it can't be "turned on" or "turned off", but rather is a result of the PHP installation in the server itself. Even then, it may be automatically "on" no matter what, I'm not sure, to be honest. In any case, that would be under the control of the sysop/company managing your server.

If there's no log entry since 2005 for that folder, that should mean either that there have been no actual PHP errors by any PHP code *residing in that folder* since 2005, or that there have been no error because the code is not actually being used.
As far as testing, I am changing the code, then acting as a user and uploading files to the server and seeing what gets emailed to me, and if the links work......

Sorry, I really suck at PHP..... :(
No need to apologize. I'm kinda/sorta semi-fluent in PHP, but certainly no guru in it either. My problem is I'll go a couple of years in between major coding projects and I'll have to remember things and blow cobwebs out of my head all over again every time :(.

Anyway, if you want to check and see if the code is even running, stick a sendmail in the code right before or after that questionable line in that file. If you get the mail from the sendmail before it, the script is at least running. If you get the mail after it, you can have it send you the before and after values of the filename variables and use that as a check to see whazzup.

I'm not sure if you want to answer this question here, I'll understand completely if you don't; but I'm curious as to where this code came from originally.

G.
 
I'm not sure if you want to answer this question here, I'll understand completely if you don't; but I'm curious as to where this code came from originally.


How do I insert a "sendmail"?

As far as the code - the concept was mine, but I paid to have it coded, then paid to have that code fixed, then paid again to have it completely re-coded. With a few free "helps" from some HR people. It's still not to where I'd like it to be, but I pay for it out of my pocket, and right now, my pockets aren't very deep. The server alone cost's me almost $400 a year. :(

If there's an error log file there, it's configured to work that way. AFIK, it can't be "turned on" or "turned off", but rather is a result of the PHP installation in the server itself. Even then, it may be automatically "on" no matter what, I'm not sure, to be honest. In any case, that would be under the control of the sysop/company managing your server.

If there's no log entry since 2005 for that folder, that should mean either that there have been no actual PHP errors by any PHP code *residing in that folder* since 2005, or that there have been no error because the code is not actually being used.No need to apologize. I'm kinda/sorta semi-fluent in PHP, but certainly no guru in it either. My problem is I'll go a couple of years in between major coding projects and I'll have to remember things and blow cobwebs out of my head all over again every time :(.


Well, all the code is in that folder, except for the "includes" folder I think it's called. The code is broken up into a few different files, all of them in the public_html folder (I use cpanel to access the server)

.
 
Last edited:
Back
Top